Show / Hide Table of Contents

    Class CommandLineApplicationExtensions

    Helper methods for CommandLineApplication.

    Inheritance
    System.Object
    CommandLineApplicationExtensions
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    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
    public static class CommandLineApplicationExtensions

    Methods

    | Improve this Doc View Source

    HelpOption(CommandLineApplication)

    Adds the help option with the template -?|-h|--help.

    Declaration
    public static CommandOption HelpOption(this CommandLineApplication app)
    Parameters
    Type Name Description
    CommandLineApplication app
    Returns
    Type Description
    CommandOption
    | Improve this Doc View Source

    OnExecute(CommandLineApplication, Action)

    Sets Invoke with a return code of 0.

    Declaration
    public static void OnExecute(this CommandLineApplication app, Action action)
    Parameters
    Type Name Description
    CommandLineApplication app
    System.Action action
    | Improve this Doc View Source

    OnValidationError(CommandLineApplication, Action<ValidationResult>)

    Sets an action to invoke, but only when there is a validation error.

    Declaration
    public static void OnValidationError(this CommandLineApplication app, Action<ValidationResult> action)
    Parameters
    Type Name Description
    CommandLineApplication app
    System.Action<System.ComponentModel.DataAnnotations.ValidationResult> action
    | Improve this Doc View Source

    OnValidationError(CommandLineApplication, Func<ValidationResult, Int32>)

    Sets an action to invoke, but only when there is a validation error.

    Declaration
    public static void OnValidationError(this CommandLineApplication app, Func<ValidationResult, int> action)
    Parameters
    Type Name Description
    CommandLineApplication app
    System.Func<System.ComponentModel.DataAnnotations.ValidationResult, System.Int32> action
    | Improve this Doc View Source

    VerboseOption(CommandLineApplication)

    Adds the verbose option with the template -v|--verbose.

    Declaration
    public static CommandOption VerboseOption(this CommandLineApplication app)
    Parameters
    Type Name Description
    CommandLineApplication app
    Returns
    Type Description
    CommandOption
    | Improve this Doc View Source

    VerboseOption(CommandLineApplication, String)

    Adds the verbose option with the template -v|--verbose.

    Declaration
    public static CommandOption VerboseOption(this CommandLineApplication app, string template)
    Parameters
    Type Name Description
    CommandLineApplication app
    System.String template
    Returns
    Type Description
    CommandOption
    | Improve this Doc View Source

    VersionOptionFromAssemblyAttributes(CommandLineApplication, Assembly)

    Finds System.Reflection.AssemblyInformationalVersionAttribute on assembly and uses that to set OptionVersion.

    Uses the Version that is part of the System.Reflection.AssemblyName of the specified assembly if no System.Reflection.AssemblyInformationalVersionAttribute is applied.

    Declaration
    public static CommandOption VersionOptionFromAssemblyAttributes(this CommandLineApplication app, Assembly assembly)
    Parameters
    Type Name Description
    CommandLineApplication app
    System.Reflection.Assembly assembly
    Returns
    Type Description
    CommandOption
    Exceptions
    Type Condition
    System.ArgumentNullException

    Either app or assembly is null.

    | Improve this Doc View Source

    VersionOptionFromAssemblyAttributes(CommandLineApplication, String, Assembly)

    Finds System.Reflection.AssemblyInformationalVersionAttribute on assembly and uses that to set OptionVersion.

    Uses the Version that is part of the System.Reflection.AssemblyName of the specified assembly if no System.Reflection.AssemblyInformationalVersionAttribute is applied.

    Declaration
    public static CommandOption VersionOptionFromAssemblyAttributes(CommandLineApplication app, string template, Assembly assembly)
    Parameters
    Type Name Description
    CommandLineApplication app
    System.String template
    System.Reflection.Assembly assembly
    Returns
    Type Description
    CommandOption
    Exceptions
    Type Condition
    System.ArgumentNullException

    Either app or assembly is null.

    • Improve this Doc
    • View Source
    Back to top Generated with docfx