Class TemplateDirective

Create a new file based on a template registered with the CommandLine service.

Hierarchy

Constructors

Properties

logging: Logging

Accessors

Methods

  • Determines if, at any point in the arguments, the help option's short or long flag appears.

    Returns

    • true if the help flag appeared

    Parameters

    • argv: string[]

    Returns boolean

  • Get the method with the given name from this class, bound to this class.

    Returns

    function

    Parameters

    • methodName: string

    Returns ((...args: any[]) => any)

      • (...args: any[]): any
      • Get the method with the given name from this class, bound to this class.

        Returns

        function

        Parameters

        • Rest ...args: any[]

        Returns any

  • Get the keyword or array of keywords that will specify this directive.

    Example

    If this returns ['up', 'start'], the directive can be run by either of:

    ./ex up
    ./ex start

    Returns string | string[]

  • Get the main keyword displayed for this directive.

    Example

    If getKeywords() returns ['up', 'start'], this will return 'up'.

    Returns string

  • Called when the directive is run from the command line.

    The raw arguments are provided as argv, but you are encouraged to use getOptions() and option() helpers to access the parsed options instead.

    Returns Promise<void>

  • Create an instance of CLIOption based on a string definition of a particular format.

    e.g. '{file name} | canonical name of the resource to create' e.g. '--push -p {value} | the value to be pushed' e.g. '--force -f | do a force push'

    Parameters

    • string: string

    Returns CLIOption<any>

  • Invoke this directive with the specified arguments.

    If usage was requested (see didRequestUsage()), it prints the extended usage info.

    Otherwise, it parses the options from argv and calls handle().

    Parameters

    • argv: string[]

    Returns Promise<void>

  • Call the make() method on the global container.

    Type Parameters

    • T

    Parameters

    • target: any
    • Rest ...parameters: any[]

    Returns T

  • Get the value of a parsed option. If none exists, return defaultValue.

    Parameters

    • name: string
    • Optional defaultValue: unknown

    Returns any

  • Process the raw CLI arguments using an array of option class instances to build a mapping of option names to provided values.

    Parameters

    Returns {
        [key: string]: any;
    }

    • [key: string]: any
  • Protected

    Get a promise that resolves after SIGINT is received, executing a callback beforehand.

    Parameters

    • Optional callback: (() => unknown)
        • (): unknown
        • Returns unknown

    Returns Promise<void>

  • Print the given output to the log as warning text.

    Parameters

    • output: unknown

    Returns void