Options
All
  • Public
  • Public/Protected
  • All
Menu

Command utility class. Place static utils for command processing here.

Hierarchy

  • CommandUtils

Index

Methods

Static Private addChildAndDescendantsToSearch

  • Helper recursive function for flattening a given tree definition

    Parameters

    • prefix: string

      Previous command objects to prepend to the given child name

    • child: ICommandDefinition

      Tree definition to use when searching for descendants

    • Default value includeAliases: boolean = false

      Indicates whether or not we should include aliases in the recursion

    • Default value _result: ICommandTreeEntry[] = []

      (recursion) resulting list of flattened descendants

    • Default value _tree: ICommandDefinition = child

      (recursion) Initial tree definition

    Returns ICommandTreeEntry[]

    Concatenated list of flattened descendants

Static flattenCommandTree

Static flattenCommandTreeWithAliases

Static getFullCommandName

Static getOptionDefinitionFromName

Static optionWasSpecified

  • optionWasSpecified(optionName: string, commandDefinition: ICommandDefinition, args: ICommandArguments["args"]): boolean

Static reconstructCommand

  • reconstructCommand(commandArguments: Arguments, commandDefinition: ICommandDefinition): string
  • Get a representation of the original command as issued by the user .with all canonical forms of options specified. You only need to supply the "command" segement of your command. The "full command" (including previous groups, etc.) is extracted from the yargs arguments object "_" property. TODO: Replace "maincommand" below with the name of the bin - This is new to Imperative.

    Parameters

    • commandArguments: Arguments

      The Yargs style argument object. Requires the "_" (input argv)

    • commandDefinition: ICommandDefinition

      The command definition document

    Returns string

    • The reconstructed command (as would have been issued on the console).

Generated using TypeDoc