Search Results for

    Show / Hide Table of Contents

    Class CommandAttribute

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

    Inheritance
    System.Object
    System.Attribute
    CommandAttribute
    Inherited Members
    System.Attribute.Equals(System.Object)
    System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
    System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type, System.Boolean)
    System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type)
    System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type, System.Boolean)
    System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type)
    System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type, System.Boolean)
    System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type)
    System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.Assembly)
    System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type)
    System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo)
    System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type)
    System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.Module)
    System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type)
    System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo)
    System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
    System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)
    System.Attribute.GetHashCode()
    System.Attribute.IsDefaultAttribute()
    System.Attribute.IsDefined(System.Reflection.Assembly, System.Type)
    System.Attribute.IsDefined(System.Reflection.Assembly, System.Type, System.Boolean)
    System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type)
    System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type, System.Boolean)
    System.Attribute.IsDefined(System.Reflection.Module, System.Type)
    System.Attribute.IsDefined(System.Reflection.Module, System.Type, System.Boolean)
    System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
    System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
    System.Attribute.Match(System.Object)
    System.Attribute.TypeId
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: McMaster.Extensions.CommandLineUtils
    Assembly: McMaster.Extensions.CommandLineUtils.dll
    Syntax
    [AttributeUsage(AttributeTargets.Class)]
    public sealed class CommandAttribute : Attribute

    Constructors

    | Improve this Doc View Source

    CommandAttribute()

    Initializes a new CommandAttribute.

    Declaration
    public CommandAttribute()
    | Improve this Doc View Source

    CommandAttribute(String)

    Initializes a new CommandAttribute.

    Declaration
    public CommandAttribute(string name)
    Parameters
    Type Name Description
    System.String name

    The name of the command.

    | Improve this Doc View Source

    CommandAttribute(String[])

    Initializes a new CommandAttribute.

    Declaration
    public CommandAttribute(params string[] names)
    Parameters
    Type Name Description
    System.String[] names

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

    Properties

    | Improve this Doc View Source

    AllowArgumentSeparator

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

    Declaration
    public bool AllowArgumentSeparator { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    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.

    Declaration
    public bool ClusterOptions { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html

    | Improve this Doc View Source

    Description

    A description of the command. Description

    Declaration
    public string? Description { get; set; }
    Property Value
    Type Description
    System.Nullable<System.String>
    | Improve this Doc View Source

    ExtendedHelpText

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

    Declaration
    public string? ExtendedHelpText { get; set; }
    Property Value
    Type Description
    System.Nullable<System.String>
    | Improve this Doc View Source

    FullName

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

    Declaration
    public string? FullName { get; set; }
    Property Value
    Type Description
    System.Nullable<System.String>
    | Improve this Doc View Source

    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. Name

    Declaration
    public string? Name { get; set; }
    Property Value
    Type Description
    System.Nullable<System.String>
    | Improve this Doc View Source

    Names

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

    Declaration
    public IEnumerable<string> Names { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<System.String>
    | Improve this Doc View Source

    OptionsComparison

    The way arguments and options are matched.

    Declaration
    public StringComparison OptionsComparison { get; set; }
    Property Value
    Type Description
    System.StringComparison
    | Improve this Doc View Source

    ParseCulture

    Specifies the culture used to convert values into types.

    Declaration
    public CultureInfo ParseCulture { get; set; }
    Property Value
    Type Description
    System.Globalization.CultureInfo
    | Improve this Doc View Source

    ResponseFileHandling

    Treat arguments beginning as &apos;@' as a response file. ResponseFileHandling

    Declaration
    public ResponseFileHandling ResponseFileHandling { get; set; }
    Property Value
    Type Description
    ResponseFileHandling
    | Improve this Doc View Source

    ShowInHelpText

    Determines if this command appears in generated help text. ShowInHelpText

    Declaration
    public bool ShowInHelpText { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    ThrowOnUnexpectedArgument

    Throw when unexpected arguments are encountered. ThrowOnUnexpectedArgument

    Declaration
    public bool ThrowOnUnexpectedArgument { get; set; }
    Property Value
    Type Description
    System.Boolean
    • Improve this Doc
    • View Source
    In This Article
    Back to top