• Public
  • Public/Protected
  • All

Class CommandPreparer

Command preparer provides static utilities to ensure that command definitions are suitable for Imperative definition.


  • CommandPreparer



Static Private appendAutoOptions

Static Private appendPassOnOptions

Static Private ignoreNode

Static Private passOn

  • A command definition node can indicate any arbitrary field be "passed on" to it's children. The intention is to provide convienence for the coder of definition document, when they want to apply the same attributes (such as reading from stdin OR which profiles are required) to all of its decedents.


    • definition: ICommandDefinition

      the original command document

    • Optional inherit: ICommandDefinitionPassOn[]

      the current set of attributes/fields being "passed on" - if a "pass on" specification is found in a child document, it overwrites the parents (takes precedence)

    Returns void

    A copy of the original with all "passed on" fields.

Static Private perfomBasicValidation

  • Perform preliminary (or post prepared) basic validation of the command definition tree. Checks to ensure that absoultely necessary fields are populated and invalid combos are not present.

    Note: The root command is a bit of a special case, and is immune to some validation - we can't have a name associated because that would cause an extra segment added in yargs.


    Returns void

Static Private performBasicOptionValidation

Static Private performBasicPositionalValidation

Static Private populatePassOnValueFromParent

  • If the "passOn" specification does not indicate a value, we will extract the value/trait from the parent and populate the "passOn" value. This allows parents to pass on their own properties/traits.




    Returns void

Static prepare

Static Private setDefaultValues

Static validateDefinitionTree

Generated using TypeDoc