Skip to content

CommandAttribute

bramerdaniel edited this page Oct 20, 2022 · 8 revisions

Decorating a property with the CommandAttribute looks like this.

[Command("detete", "d")]
public DeleteCommand Detete { get; set; }

Using this CommandAttribute is required if an application should be able to perform multiple different action by passing different arguments. If one of the defined commands should be used as default (without the usage of one of its identifiers) set the 'IsDefaultCommand' property to true.

[Command("copy", "c", IsDefaultCommand = true)]
[HelpText("Copies the source to the destination.")]
public CopyCommand Copy { get; set; } 

For more details how to implement an application using commands see the Commands page.

For the other available attributes see the argument attributes page

Clone this wiki locally