Table of Contents

Class CommandAttribute

Namespace
McMaster.Extensions.CommandLineUtils
Assembly
McMaster.Extensions.CommandLineUtils.dll

Represents a command line application using attributes to define options and arguments.

[AttributeUsage(AttributeTargets.Class)]
public sealed class CommandAttribute : Attribute
Inheritance
object
Attribute
CommandAttribute

Constructors

CommandAttribute()

Initializes a new CommandAttribute.

public CommandAttribute()

CommandAttribute(string)

Initializes a new CommandAttribute.

public CommandAttribute(string name)

Parameters

name string

The name of the command.

CommandAttribute(params string[])

Initializes a new CommandAttribute.

public CommandAttribute(params string[] names)

Parameters

names string[]

The names of the command. The first name given is the primary name

Properties

AllowArgumentSeparator

Allow '--' to be used to stop parsing arguments.

public bool AllowArgumentSeparator { get; set; }

Property Value

bool
See Also

ClusterOptions

One or more options of NoValue, followed by at most one option that takes values, should be accepted when grouped behind one '-' delimiter.

When true, the following are equivalent.

-abcXyellow
-abcX=yellow
-abcX:yellow
-abc -X=yellow
-ab -cX=yellow
-a -b -c -Xyellow
-a -b -c -X yellow
-a -b -c -X=yellow
-a -b -c -X:yellow

This defaults to true unless an option with a short name of two or more characters is added.

public bool ClusterOptions { get; set; }

Property Value

bool

Remarks

Description

A description of the command.

public string? Description { get; set; }

Property Value

string
See Also

ExtendedHelpText

Additional text that appears at the bottom of generated help text.

public string? ExtendedHelpText { get; set; }

Property Value

string
See Also

FullName

The full name of the command line application to show in help text.

public string? FullName { get; set; }

Property Value

string
See Also

Name

The name of the command line application. When this is a subcommand, it is the name of the word used to invoke the subcommand.

public string? Name { get; set; }

Property Value

string
See Also

Names

THe names of the command. The first is the primary name. All other names are aliases.

public IEnumerable<string> Names { get; }

Property Value

IEnumerable<string>

OptionsComparison

The way arguments and options are matched.

public StringComparison OptionsComparison { get; set; }

Property Value

StringComparison

ParseCulture

Specifies the culture used to convert values into types.

public CultureInfo ParseCulture { get; set; }

Property Value

CultureInfo

ResponseFileHandling

Treat arguments beginning as '@' as a response file.

public ResponseFileHandling ResponseFileHandling { get; set; }

Property Value

ResponseFileHandling
See Also

ShowInHelpText

Determines if this command appears in generated help text.

public bool ShowInHelpText { get; set; }

Property Value

bool
See Also

UnrecognizedArgumentHandling

Set the behavior for how to handle unrecognized arguments.

public UnrecognizedArgumentHandling UnrecognizedArgumentHandling { get; set; }

Property Value

UnrecognizedArgumentHandling

UsePagerForHelpText

Whether a Pager should be used to display help text.

public bool UsePagerForHelpText { get; set; }

Property Value

bool