Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Argument<T> Class

Definition

Namespace:
System.CommandLine
Assembly:
System.CommandLine.dll
Package:
System.CommandLine v3.0.0-preview.5.26302.115
Source:
Argument{T}.cs
Source:
Argument{T}.cs
Source:
Argument{T}.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

A symbol defining a value that can be passed on the command line to a command or option.

generic <typename T>
public ref class Argument : System::CommandLine::Argument
public class Argument<T> : System.CommandLine.Argument
type Argument<'T> = class
 inherit Argument
Public Class Argument(Of T)
Inherits Argument

Type Parameters

T
Inheritance
Argument<T>

Constructors

Name Description
Argument<T>(String)

Initializes a new instance of the Argument class.

Properties

Name Description
Arity

Gets or sets the arity of the argument.

(Inherited from Argument)
CaptureRemainingTokens

Gets or sets a value indicating whether this argument captures all remaining tokens.

(Inherited from Argument)
CompletionSources

Gets the list of completion sources for the argument.

(Inherited from Argument)
CustomParser

Gets or sets a custom argument parser.

DefaultValueFactory

Gets or sets the delegate to invoke to create the default value.

Description

Gets or sets the description of the symbol.

(Inherited from Symbol)
HasDefaultValue

Specifies if a default value is defined for the argument.

HelpName

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

(Inherited from Argument)
Hidden

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

(Inherited from Symbol)
Name

Gets the name of the symbol.

(Inherited from Symbol)
Parents

Gets the parent symbols.

(Inherited from Symbol)
Validators

Provides a list of argument validators. Validators can be used to provide custom errors based on user input.

(Inherited from Argument)
ValueType

Gets or sets the Type that the argument's parsed tokens will be converted to.

Methods

Name Description
GetCompletions(CompletionContext)

Gets completions for the symbol.

(Inherited from Argument)
GetDefaultValue()

Gets the default value for the argument.

(Inherited from Argument)
ToString()

Returns a string that represents the current object.

(Inherited from Argument)

Extension Methods

Name Description
AcceptExistingOnly<T>(Argument<T>)

Configures an argument to accept only values corresponding to a existing files or directories.

AcceptLegalFileNamesOnly<T>(Argument<T>)

Configures the argument to accept only values representing legal file names.

AcceptLegalFilePathsOnly<T>(Argument<T>)

Configures the argument to accept only values representing legal file paths.

AcceptOnlyFromAmong<T>(Argument<T>, String[])

Configures the argument to accept only the specified values, and to suggest them as command line completions.

AcceptOnlyFromAmong<T>(Argument<T>, StringComparer, String[])

Configures the argument to accept only the specified values using the specified comparer, and to suggest them as command line completions.

Applies to


Feedback

Was this page helpful?