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

### Hierarchy

- CommandPreparer

## Index

### Methods

- appendAutoOptions
- appendPassOnOptions
- ignoreNode
- passOn
- perfomBasicValidation
- performBasicOptionValidation
- performBasicPositionalValidation
- populatePassOnValueFromParent
- prepare
- setDefaultValues
- validateDefinitionTree

## Methods

### Static Private appendAutoOptions

- appendAutoOptions(definition: ICommandDefinition, baseProfileOptions: ICommandOptionDefinition[]): ICommandDefinition

- - Defined in @zowe/imperative/src/cmd/src/CommandPreparer.ts:475

  Appends options (for profiles, global options like help, etc.) automatically

  #### Parameters

  - ##### definition: ICommandDefinition

    The original command definition tree to "prepare"

  - ##### baseProfileOptions: ICommandOptionDefinition[]

    Option definitions sourced from base profile

  #### Returns ICommandDefinition

  A copy of the original that has been prepared

### Static Private appendPassOnOptions

- appendPassOnOptions(definition: ICommandDefinition): void

- - Defined in @zowe/imperative/src/cmd/src/CommandPreparer.ts:433

  Appends items which should be passed on to later nodes

  #### Parameters

  - ##### definition: ICommandDefinition

    The original command definition tree to "prepare"

  #### Returns void

### Static Private ignoreNode

- ignoreNode(node: ICommandDefinition, ignore: ICommandDefinitionPassOnIgnore[]): boolean

- - Defined in @zowe/imperative/src/cmd/src/CommandPreparer.ts:663

  Check if the current node should be ignored. The name of the node is checked agaisnt the specification in the pass on parameters.

  #### Parameters

  - ##### node: ICommandDefinition

    The command definition node

  - ##### ignore: ICommandDefinitionPassOnIgnore[]

    The names to ignore

  #### Returns boolean

  - True if we are to ignore passing on attributes to the passed definition node.

### Static Private passOn

- passOn(definition: ICommandDefinition, inherit?: ICommandDefinitionPassOn[]): void

- - Defined in @zowe/imperative/src/cmd/src/CommandPreparer.ts:607

  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.

  #### Parameters

  - ##### 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

- perfomBasicValidation(definition: ICommandDefinition, definitions: ICommandDefinition[]): void

- - Defined in @zowe/imperative/src/cmd/src/CommandPreparer.ts:129

  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.

  #### Parameters

  - ##### definition: ICommandDefinition

    The current command definition in the tree

  - ##### definitions: ICommandDefinition[]

    the current set of definitions we've traversed - for diagnostics

  #### Returns void

### Static Private performBasicOptionValidation

- performBasicOptionValidation(definition: ICommandDefinition): void

- - Defined in @zowe/imperative/src/cmd/src/CommandPreparer.ts:323

  Perform basic option operand validation. Ensure that the option operands are valid and well formed.

  static
  memberof

    CommandPreparer

  #### Parameters

  - ##### definition: ICommandDefinition

    The command definition containing options to be validated

  #### Returns void

### Static Private performBasicPositionalValidation

- performBasicPositionalValidation(definition: ICommandDefinition): void

- - Defined in @zowe/imperative/src/cmd/src/CommandPreparer.ts:281

  Perform basic positional operand validation. Ensure that the positional operands are valid and well formed.

  static
  memberof

    CommandPreparer

  #### Parameters

  - ##### definition: ICommandDefinition

    The command definition containing positionals to be validated

  #### Returns void

### Static Private populatePassOnValueFromParent

- populatePassOnValueFromParent(definition: ICommandDefinition): void

- - Defined in @zowe/imperative/src/cmd/src/CommandPreparer.ts:394

  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.

  static
  memberof

    CommandPreparer

  #### Parameters

  - ##### definition: ICommandDefinition

    the full definition tree

  #### Returns void

### Static prepare

- prepare(original: ICommandDefinition, baseProfile?: ICommandProfileTypeConfiguration): ICommandDefinition

- - Defined in @zowe/imperative/src/cmd/src/CommandPreparer.ts:34

  Prepare the command definition and apply any pass on traits to children. After a definition has been prepared, it should be considered final.

  #### Parameters

  - ##### original: ICommandDefinition

    The original command definition tree to "prepare"

  - ##### Optional baseProfile: ICommandProfileTypeConfiguration

    An optional base profile to add to command definitions

  #### Returns ICommandDefinition

  A copy of the original that has been prepared

### Static Private setDefaultValues

- setDefaultValues(definition: ICommandDefinition): void

- - Defined in @zowe/imperative/src/cmd/src/CommandPreparer.ts:372

  If optional fields have not been populated in the original definition, ensure they are set to the appropriate defaults.

  static
  memberof

    CommandPreparer

  #### Parameters

  - ##### definition: ICommandDefinition

    the definition tree to set the default values

  #### Returns void

### Static validateDefinitionTree

- validateDefinitionTree(definitionTree: ICommandDefinition): void

- - Defined in @zowe/imperative/src/cmd/src/CommandPreparer.ts:109

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

  #### Parameters

  - ##### definitionTree: ICommandDefinition

    full tree of command definitions to validate

  #### Returns void

Generated using TypeDoc