/
githubmirror
/
PowerShell
Обзор
Документация
Войти
/
githubmirror
/
PowerShell
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/Microsoft.PowerShell.Commands.Utility/commands/utility/WriteAliasCommandBase.cs
88 строк
2 KB
Armaan Mcleod
Add `-Scope` argument completer for `*-Variable`, `*-Alias` & `*-PSDrive` commands (#20451)
19 дек 2023, 12:12
Не верифицирован
19 дек 2023, 12:12
9383f55
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Management.Automation; namespace Microsoft.PowerShell.Commands { /// <summary> /// The base class for the SetAliasCommand and NewAliasCommand. /// </summary> public class WriteAliasCommandBase : PSCmdlet { #region Parameters /// <summary> /// The Name parameter for the command. /// </summary> [Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true)] public string Name { get; set; } /// <summary> /// The Value parameter for the command. /// </summary> [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true)] public string Value { get; set; } /// <summary> /// The description for the alias. /// </summary> [Parameter] public string Description { get; set; } = string.Empty; /// <summary> /// The Option parameter allows the alias to be set to /// ReadOnly (for existing aliases) and/or Constant (only /// for new aliases). /// </summary> [Parameter] public ScopedItemOptions Option { get; set; } = ScopedItemOptions.None; /// <summary> /// If set to true, the alias that is set is passed to the pipeline. /// </summary> [Parameter] public SwitchParameter PassThru { get { return _passThru; } set { _passThru = value; } } private bool _passThru; /// <summary> /// The scope parameter for the command determines which scope the alias is set in. /// </summary> [Parameter] [ArgumentCompleter(typeof(ScopeArgumentCompleter))] public string Scope { get; set; } /// <summary> /// If set to true and an existing alias of the same name exists /// and is ReadOnly, the alias will be overwritten. /// </summary> [Parameter] public SwitchParameter Force { get { return _force; } set { _force = value; } } private bool _force; #endregion Parameters } }