Command attributes

The Energy.Attribute.Command namespace provides attributes for command-line option parsing.

OptionAttribute

Energy.Attribute.Command.OptionAttribute marks a field or property as a command-line option.

public class Options
{
    [Energy.Attribute.Command.Option("input", Short = "i", Long = "input")]
    public string Input;

    [Energy.Attribute.Command.Option("output", Short = "o", Long = "output")]
    public string Output;

    [Energy.Attribute.Command.Option("verbose", Short = "v")]
    public bool Verbose;
}

Properties

Property Description
Name Primary option name.
Short Short option name.
Long Long option name.
Alternatives Additional aliases.

ArgumentAttribute

Energy.Attribute.Command.ArgumentAttribute marks a positional argument.

WelcomeAttribute

Energy.Attribute.Command.WelcomeAttribute provides welcome text for command-line applications.

See also

  • core-configuration for attribute-driven configuration.

  • core-shell for option styles.

  • base-command for fluent argument parsing.