語言

Command 類別

定義

表示應用程式執行的特定動作。

public ref class Command : System::CommandLine::Symbol, System::Collections::IEnumerable
public ref class Command : System::CommandLine::Symbol, System::Collections::Generic::IEnumerable<System::CommandLine::Symbol ^>, System::CommandLine::ICommand
public class Command : System.CommandLine.Symbol, System.Collections.IEnumerable
public class Command : System.CommandLine.Symbol, System.Collections.Generic.IEnumerable<System.CommandLine.Symbol>, System.CommandLine.ICommand
type Command = class
    inherit Symbol
    interface IEnumerable
type Command = class
    inherit Symbol
    interface ICommand
    interface ISymbol
    interface ISuggestionSource
    interface seq<Symbol>
    interface IEnumerable
Public Class Command
Inherits Symbol
Implements IEnumerable
Public Class Command
Inherits Symbol
Implements ICommand, IEnumerable(Of Symbol)
繼承
Command
衍生
實作

備註

使用 Command 物件來處理對應特定字串(命令名稱)的動作。 對於只有一個動作的簡單應用,請參見 RootCommand。 例如, dotnet run 作為 run 指令。

建構函式

名稱 Description
Command(String, String)

初始化一個新的 Command 類別實例。

屬性

名稱 Description
Action

接收或設定 CommandLineAction 指揮。 處理器代表指令被呼叫時將執行的動作。

Aliases

取得可用於命令列指定指令的獨特字串集合。

Aliases

表示應用程式執行的特定動作。

(繼承來源 Symbol)
Argument
已淘汰.

表示應用程式執行的特定動作。

Arguments

能取得所有該指令的論點。

Children

會獲得子符號。

Children

表示應用程式執行的特定動作。

(繼承來源 Symbol)
Description

取得或設定符號的描述。

(繼承來源 Symbol)
Handler

表示應用程式執行的特定動作。

Hidden

取得或設定一個值,表示該符號是否被隱藏。

(繼承來源 Symbol)
IsHidden

表示應用程式執行的特定動作。

(繼承來源 Symbol)
Name

會得到符號名稱。

(繼承來源 Symbol)
Options

它會獲得所有指令的選項。

Parents

取得父代碼。

(繼承來源 Symbol)
RawAliases

表示應用程式執行的特定動作。

(繼承來源 Symbol)
Subcommands

會取得該指令的所有子指令。

TreatUnmatchedTokensAsErrors

取得或設定一個值,指示未匹配的標記是否應視為錯誤。

Validators

讓驗證者接收到指令。 驗證器可用來建立自訂的驗證邏輯。

方法

名稱 Description
Add(Argument)

在指令中加入 a Argument 。

Add(Command)

在指令中加入 a Command 。

Add(Option)

在指令中加入了 。Option

Add(Symbol)

表示應用程式執行的特定動作。

AddAlias(String)

表示應用程式執行的特定動作。

AddAliasInner(String)

表示應用程式執行的特定動作。

(繼承來源 Symbol)
AddArgument(Argument)

表示應用程式執行的特定動作。

AddCommand(Command)

表示應用程式執行的特定動作。

AddOption(Option)

表示應用程式執行的特定動作。

AddValidator(ValidateSymbol<CommandResult>)

表示應用程式執行的特定動作。

ClearAliases()

表示應用程式執行的特定動作。

(繼承來源 Symbol)
GetCompletions(CompletionContext)

取得符號的補全。

GetEnumerator()

表示應用程式執行的特定動作。

HasAlias(String)

表示應用程式執行的特定動作。

(繼承來源 Symbol)
HasRawAlias(String)

表示應用程式執行的特定動作。

(繼承來源 Symbol)
Parse(IReadOnlyList<String>, ParserConfiguration)

用指令解析陣列字串。

Parse(String, ParserConfiguration)

使用 命令解析命令列字串值。

SetAction(Action<ParseResult>)

設定一個同步動作,當指令被呼叫時執行。

SetAction(Func<ParseResult,CancellationToken,Task<Int32>>)

當指令被呼叫時,會設定一個非同步動作。

SetAction(Func<ParseResult,CancellationToken,Task>)

設定一個非同步動作,在呼叫指令時執行。

SetAction(Func<ParseResult,Int32>)

設定一個同步動作,當指令被呼叫時執行。

SetAction(Func<ParseResult,Task<Int32>>)

設定一個非同步動作,在呼叫指令時執行。

SetAction(Func<ParseResult,Task>)

設定一個非同步動作,在呼叫指令時執行。

Suggest(String)

表示應用程式執行的特定動作。

(繼承來源 Symbol)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Symbol)

明確介面實作

名稱 Description
ICommand.Argument

表示應用程式執行的特定動作。

ICommand.Arguments

表示應用程式執行的特定動作。

ICommand.Options

表示應用程式執行的特定動作。

IEnumerable.GetEnumerator()

傳回逐一查看集合的列舉值。

ISymbol.Children

表示應用程式執行的特定動作。

(繼承來源 Symbol)

擴充方法

名稱 Description
ConfigureFromMethod(Command, MethodInfo, Object)

表示應用程式執行的特定動作。

Invoke(Command, String, IConsole)

表示應用程式執行的特定動作。

Invoke(Command, String[], IConsole)

表示應用程式執行的特定動作。

InvokeAsync(Command, String, IConsole)

表示應用程式執行的特定動作。

InvokeAsync(Command, String[], IConsole)

表示應用程式執行的特定動作。

Parse(Command, String, IReadOnlyCollection<Char>)

表示應用程式執行的特定動作。

Parse(Command, String[])

表示應用程式執行的特定動作。

ToAsyncEnumerable<TSource>(IEnumerable<TSource>)

將 IEnumerable<T> 轉換成 IAsyncEnumerable<T>。

ToFrozenDictionary<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)

根據指定的索引鍵選取器和項目選取器函式,從 FrozenDictionary<TKey,TValue> 建立 IEnumerable<T>。

ToFrozenDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

根據指定的鍵選擇函式從 FrozenDictionary<TKey,TValue> a 建立 。IEnumerable<T>

ToFrozenSet<T>(IEnumerable<T>, IEqualityComparer<T>)

建立 FrozenSet<T> 一個符合指定值的 。

ToImmutableArray<TSource>(IEnumerable<TSource>)

從指定的集合建立不可變的陣列。

ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IEqualityComparer<TKey>, IEqualityComparer<TValue>)

列舉和轉換序列,並使用指定的索引鍵和值比較子產生其內容的不可變字典。

ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IEqualityComparer<TKey>)

列舉和轉換序列,並使用指定的索引鍵比較子產生其內容的不可變字典。

ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>)

列舉和轉換序列,併產生其內容的不可變字典。

ToImmutableDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

根據序列的一些轉換,建構不可變的字典。

ToImmutableDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

從現有的專案集合建構不可變的字典,將轉換函式套用至來源索引鍵。

ToImmutableHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

列舉序列、產生其內容的不可變哈希集,並使用集合類型的指定相等比較子。

ToImmutableHashSet<TSource>(IEnumerable<TSource>)

列舉序列,併產生其內容的不可變哈希集。

ToImmutableList<TSource>(IEnumerable<TSource>)

列舉序列,併產生其內容的不可變清單。

ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IComparer<TKey>, IEqualityComparer<TValue>)

列舉和轉換序列,並使用指定的索引鍵和值比較子產生其內容的不可變排序字典。

ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IComparer<TKey>)

列舉和轉換序列,並使用指定的索引鍵比較子產生其內容的不可變排序字典。

ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>)

列舉和轉換序列,併產生其內容的不可變排序字典。

ToImmutableSortedSet<TSource>(IEnumerable<TSource>, IComparer<TSource>)

列舉序列、產生其內容的不可變排序集,並使用指定的比較子。

ToImmutableSortedSet<TSource>(IEnumerable<TSource>)

列舉序列,併產生其內容的不可變排序集。

UseCommandHandler<THandler>(Command)

表示應用程式執行的特定動作。

適用於