Define an Imperative Command to Yargs. A command implies that an implementation is present (differs from a "group") and it does not have children.

### Hierarchy

- AbstractCommandYargs
  - CommandYargs

## Index

### Constructors

- constructor

### Properties

- log
- yargsParms
- STOP_YARGS

### Accessors

- commandLine
- definition
- envVariablePrefix
- helpGeneratorFactory
- parents
- promptPhrase
- responseParms
- rootCommandName
- yargs

### Methods

- buildPositionalString
- constructDefinitionTree
- defineCommandToYargs
- executeHelp
- executeWebHelp
- getDepthExamples
- getZoweYargsResponse
- invokeHandlers
- defineOptionsToYargs

## Constructors

### constructor

- new CommandYargs(yargsParms: IYargsParms): CommandYargs

- Inherited from CommandYargs.constructor

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:99

  Construct the yargs command instance for imperative. Provides the ability to define Imperative commands to Yargs.

  #### Parameters

  - ##### yargsParms: IYargsParms

    Parameter object contains parms for Imperative/Yargs and command response objects

  #### Returns CommandYargs

## Properties

### Protected log

log: Logger = Logger.getImperativeLogger()

Inherited from CommandYargs.log

- Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:43

### Protected yargsParms

yargsParms: IYargsParms

Inherited from CommandYargs.yargsParms

- Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:105

Parameter object contains parms for Imperative/Yargs and command response objects

### Static STOP_YARGS

STOP_YARGS: boolean = false

Inherited from CommandYargs.STOP_YARGS

- Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:41

TODO: REMOVE THIS, workaround for yargs.fail() problem

## Accessors

### Protected commandLine

- get commandLine(): string

- Inherited from CommandYargs.commandLine

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:134

  Accessor for the command line

  readonly
  memberof

    AbstractCommandYargs

  #### Returns string

### definition

- get definition(): ICommandDefinition

- Inherited from CommandYargs.definition

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:182

  Returns a copy of the definition.

  #### Returns ICommandDefinition

  : A copy of the definition.

### Protected envVariablePrefix

- get envVariablePrefix(): string

- Inherited from CommandYargs.envVariablePrefix

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:145

  Accessor for the Environmental variable prefix

  readonly
  memberof

    AbstractCommandYargs

  #### Returns string

### Protected helpGeneratorFactory

- get helpGeneratorFactory(): IHelpGeneratorFactory

- Inherited from CommandYargs.helpGeneratorFactory

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:174

  Accessor for the help generator factory.

  readonly
  memberof

    AbstractCommandYargs

  #### Returns IHelpGeneratorFactory

### parents

- get parents(): GroupCommandYargs[]

- Inherited from CommandYargs.parents

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:198

  Get the array of parents.

  #### Returns GroupCommandYargs[]

  : The array of parents.

### Protected promptPhrase

- get promptPhrase(): string

- Inherited from CommandYargs.promptPhrase

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:155

  Accessor for the CLI prompt phrase

  readonly
  memberof

    AbstractCommandYargs

  #### Returns string

### Protected responseParms

- get responseParms(): ICommandResponseParms

- Inherited from CommandYargs.responseParms

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:163

  Accessor for the command response parms (for subclasses)

  #### Returns ICommandResponseParms

  - Command response object

### Protected rootCommandName

- get rootCommandName(): string

- Inherited from CommandYargs.rootCommandName

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:124

  Accessor for the root command name for the CLI

  readonly
  memberof

    AbstractCommandYargs

  #### Returns string

### yargs

- get yargs(): Argv

- Inherited from CommandYargs.yargs

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:190

  Returns the Yargs instance.

  #### Returns Argv

  : The Yargs instance.

## Methods

### Private buildPositionalString

- buildPositionalString(): string

- - Defined in @zowe/imperative/src/cmd/src/yargs/CommandYargs.ts:175

  Construct the positional argument string for Yargs. The positional arguments are always constructed as "optional" to yargs. This prevents yargs from "throwing errors" if the user requests --help and the positional parameters are not specified.

  #### Returns string

  : The positional argument string used in the Yargs command definition.

### constructDefinitionTree

- constructDefinitionTree(): ICommandDefinition

- Inherited from CommandYargs.constructDefinitionTree

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:211

  Construct the Zowe command definition "tree" - the full definition document including all parents.

  #### Returns ICommandDefinition

  : The command definition "tree".

### defineCommandToYargs

- defineCommandToYargs(commandExecuted: YargsCommandCompleted): void

- Overrides AbstractCommandYargs.defineCommandToYargs

  - Defined in @zowe/imperative/src/cmd/src/yargs/CommandYargs.ts:66

  Define the Imperative JSON command definition to Yargs. Once the command is defined, Yargs will parse and invoke its 'handler' (below). The handler can then invoke the potential "chain" of handlers in sequence and is notified when they complete via a promise.

  #### Parameters

  - ##### commandExecuted: YargsCommandCompleted

    Callback invoked when a command execution is complete.

  #### Returns void

### Protected executeHelp

- executeHelp(args: Arguments, commandExecuted: YargsCommandCompleted): void

- Inherited from CommandYargs.executeHelp

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:256

  Execute the help Command for the definition.

  #### Parameters

  - ##### args: Arguments

  - ##### commandExecuted: YargsCommandCompleted

  #### Returns void

### Protected executeWebHelp

- executeWebHelp(args: Arguments, commandExecuted: YargsCommandCompleted): void

- Inherited from CommandYargs.executeWebHelp

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:377

  Execute the web help Command for the definition.

  #### Parameters

  - ##### args: Arguments

  - ##### commandExecuted: YargsCommandCompleted

  #### Returns void

### Protected getDepthExamples

- getDepthExamples(): ICommandDefinition

- Inherited from CommandYargs.getDepthExamples

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:309

  Get examples for all commands of a group

  #### Returns ICommandDefinition

### Protected getZoweYargsResponse

- getZoweYargsResponse(successful: boolean, responseMessage: string, action: ImperativeYargsCommandAction, responses?: ICommandResponse[]): IYargsResponse

- Inherited from CommandYargs.getZoweYargsResponse

  - Defined in @zowe/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts:230

  Build The Zowe Yargs response for the callback. Includes the Zowe command response and status info.

  #### Parameters

  - ##### successful: boolean

  - ##### responseMessage: string

  - ##### action: ImperativeYargsCommandAction

  - ##### Optional responses: ICommandResponse[]

  #### Returns IYargsResponse

### Private invokeHandlers

- invokeHandlers(handlers: ICommandDefinition[], index: number, argsForHandler: Arguments, responses: ICommandResponse[]): Promise<ICommandResponse[]>

- - Defined in @zowe/imperative/src/cmd/src/yargs/CommandYargs.ts:198

  Invoke the "chain" of command handlers provided for this definition.

  #### Parameters

  - ##### handlers: ICommandDefinition[]

  - ##### index: number

  - ##### argsForHandler: Arguments

  - ##### responses: ICommandResponse[]

  #### Returns Promise<ICommandResponse[]>

  : The promise to be fulfilled when all handlers are complete.

### Static defineOptionsToYargs

- defineOptionsToYargs(yargsInstance: Argv, zoweOptions: ICommandOptionDefinition[]): void

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

  Define the options to Yargs.

  #### Parameters

  - ##### yargsInstance: Argv

  - ##### zoweOptions: ICommandOptionDefinition[]

  #### Returns void

Generated using TypeDoc