// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Management.Automation; namespace Microsoft.PowerShell.Commands { /// /// The base class for the SetAliasCommand and NewAliasCommand. /// public class WriteAliasCommandBase : PSCmdlet { #region Parameters /// /// The Name parameter for the command. /// [Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true)] public string Name { get; set; } /// /// The Value parameter for the command. /// [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true)] public string Value { get; set; } /// /// The description for the alias. /// [Parameter] public string Description { get; set; } = string.Empty; /// /// The Option parameter allows the alias to be set to /// ReadOnly (for existing aliases) and/or Constant (only /// for new aliases). /// [Parameter] public ScopedItemOptions Option { get; set; } = ScopedItemOptions.None; /// /// If set to true, the alias that is set is passed to the pipeline. /// [Parameter] public SwitchParameter PassThru { get { return _passThru; } set { _passThru = value; } } private bool _passThru; /// /// The scope parameter for the command determines which scope the alias is set in. /// [Parameter] [ArgumentCompleter(typeof(ScopeArgumentCompleter))] public string Scope { get; set; } /// /// If set to true and an existing alias of the same name exists /// and is ReadOnly, the alias will be overwritten. /// [Parameter] public SwitchParameter Force { get { return _force; } set { _force = value; } } private bool _force; #endregion Parameters } }