Kieli

Option Class

Definition

A symbol defining a named parameter and a value for that parameter.

public ref class Option abstract : System::CommandLine::Symbol
public ref class Option : System::CommandLine::Symbol, System::CommandLine::IOption
public abstract class Option : System.CommandLine.Symbol
public class Option : System.CommandLine.Symbol, System.CommandLine.IOption
type Option = class
    inherit Symbol
type Option = class
    inherit Symbol
    interface IOption
    interface ISymbol
    interface ISuggestionSource
    interface IValueDescriptor
Public MustInherit Class Option
Inherits Symbol
Public Class Option
Inherits Symbol
Implements IOption
Inheritance
Option
Derived
Implements

Constructors

Name Description
Option(String, String)
Option(String, String[])

Initializes a new instance of the Option class.

Option(String[], String)

Properties

Name Description
Action

Gets or sets the CommandLineAction for the Option. The handler represents the action that will be performed when the Option is invoked.

Aliases

Gets the unique set of strings that can be used on the command line to specify the Option.

Aliases (Inherited from Symbol)
AllowMultipleArgumentsPerToken

Gets a value that indicates whether multiple argument tokens are allowed for each option identifier token.

Argument
Arity

Gets or sets the arity of the option.

Children (Inherited from Symbol)
CompletionSources

Gets the list of completion sources for the option.

Description

Gets or sets the description of the symbol.

(Inherited from Symbol)
HasDefaultValue

Specifies if a default value is defined for the option.

HelpName

Gets or sets the placeholder name shown in usage help for the option's value. The value will be wrapped in angle brackets (< and >).

Hidden

Gets or sets a value indicating whether the symbol is hidden.

(Inherited from Symbol)
IsHidden (Inherited from Symbol)
Name

Gets the name of the symbol.

(Inherited from Symbol)
Parents

Gets the parent symbols.

(Inherited from Symbol)
RawAliases (Inherited from Symbol)
Recursive

When set to true, this option will be applied to its immediate parent command or commands and recursively to their subcommands.

Required

Indicates whether the option is required when its parent command is invoked.

Validators

Validators that will be called when the option is matched by the parser.

ValueType

Gets the Type that the option's parsed tokens will be converted to.

Methods

Name Description
AddAlias(String)
AddAliasInner(String) (Inherited from Symbol)
AddValidator(ValidateSymbol<OptionResult>)
ClearAliases() (Inherited from Symbol)
GetCompletions(CompletionContext)

Gets completions for the symbol.

GetDefaultValue()

Gets the default value for the option.

HasAlias(String) (Inherited from Symbol)
HasRawAlias(String) (Inherited from Symbol)
Suggest(String) (Inherited from Symbol)
ToString()

Returns a string that represents the current object.

(Inherited from Symbol)

Explicit Interface Implementations

Name Description
IOption.Argument
ISymbol.Children (Inherited from Symbol)
IValueDescriptor.GetDefaultValue()
IValueDescriptor.HasDefaultValue
IValueDescriptor.Type
IValueDescriptor.ValueName

Extension Methods

Name Description
BuildAlias(IValueDescriptor)
Parse(Option, String)

Applies to