# OpenTokenCLI | opentoken
Documentation for opentoken

### Hierarchy

- CommandLineParser
  - OpenTokenCLI

## Index

### Constructors

- constructor

### Properties

- _verbose
- selectedAction

### Accessors

- actions
- parameters
- remainder

### Methods

- addAction
- defineChoiceParameter
- defineCommandLineRemainder
- defineFlagParameter
- defineIntegerParameter
- defineStringListParameter
- defineStringParameter
- execute
- executeWithoutErrorHandling
- getAction
- getChoiceParameter
- getFlagParameter
- getIntegerParameter
- getStringListParameter
- getStringParameter
- onDefineParameters
- onExecute
- renderHelpText
- tryGetAction

## Constructors

### constructor

- new OpenTokenCLI(): OpenTokenCLI

- Overrides CommandLineParser.__constructor

  - Defined in src/cli/OpenTokenCLI.ts:27

  #### Returns OpenTokenCLI

## Properties

### Private _verbose

_verbose: CommandLineFlagParameter

- Defined in src/cli/OpenTokenCLI.ts:27

### selectedAction

selectedAction: CommandLineAction | undefined

Inherited from OpenTokenCLI.selectedAction

- Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:383

Reports which CommandLineAction was specified on the command line.

remarks

  The value will be assigned before onExecute() is invoked.

## Accessors

### actions

- get actions(): ReadonlyArray<CommandLineAction>

- Inherited from OpenTokenCLI.actions

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:395

  Returns the list of actions that were defined for this CommandLineParser object.

  #### Returns ReadonlyArray<CommandLineAction>

### parameters

- get parameters(): ReadonlyArray<CommandLineParameter>

- Inherited from KeyAction.parameters

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:229

  Returns a collection of the parameters that were defined for this object.

  #### Returns ReadonlyArray<CommandLineParameter>

### remainder

- get remainder(): CommandLineRemainder | undefined

- Inherited from KeyAction.remainder

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:234

  If {@link CommandLineParameterProvider.defineCommandLineRemainder} was called, this object captures any remaining command line arguments after the recognized portion.

  #### Returns CommandLineRemainder | undefined

## Methods

### addAction

- addAction(action: CommandLineAction): void

- Inherited from OpenTokenCLI.addAction

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:399

  Defines a new action that can be used with the CommandLineParser instance.

  #### Parameters

  - ##### action: CommandLineAction

  #### Returns void

### defineChoiceParameter

- defineChoiceParameter(definition: ICommandLineChoiceDefinition): CommandLineChoiceParameter

- Inherited from KeyAction.defineChoiceParameter

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:245

  Defines a command-line parameter whose value must be a string from a fixed set of allowable choices (similar to an enum).

  remarks

    Example of a choice parameter:

        example-tool --log-level warn

  #### Parameters

  - ##### definition: ICommandLineChoiceDefinition

  #### Returns CommandLineChoiceParameter

### defineCommandLineRemainder

- defineCommandLineRemainder(definition: ICommandLineRemainderDefinition): CommandLineRemainder

- Inherited from KeyAction.defineCommandLineRemainder

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:327

  Defines a rule that captures any remaining command line arguments after the recognized portion.

  remarks

    This feature is useful for commands that pass their arguments along to an external tool, relying on that tool to perform validation. (It could also be used to parse parameters without any validation or documentation, but that is not recommended.)

    Example of capturing the remainder after an optional flag parameter.

        example-tool --my-flag this is the remainder

    In the "--help" documentation, the remainder rule will be represented as "...".

  #### Parameters

  - ##### definition: ICommandLineRemainderDefinition

  #### Returns CommandLineRemainder

### defineFlagParameter

- defineFlagParameter(definition: ICommandLineFlagDefinition): CommandLineFlagParameter

- Inherited from KeyAction.defineFlagParameter

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:262

  Defines a command-line switch whose boolean value is true if the switch is provided, and false otherwise.

  remarks

    Example usage of a flag parameter:

        example-tool --debug

  #### Parameters

  - ##### definition: ICommandLineFlagDefinition

  #### Returns CommandLineFlagParameter

### defineIntegerParameter

- defineIntegerParameter(definition: ICommandLineIntegerDefinition): CommandLineIntegerParameter

- Inherited from KeyAction.defineIntegerParameter

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:278

  Defines a command-line parameter whose argument is an integer.

  remarks

    Example usage of an integer parameter:

        example-tool --max-attempts 5

  #### Parameters

  - ##### definition: ICommandLineIntegerDefinition

  #### Returns CommandLineIntegerParameter

### defineStringListParameter

- defineStringListParameter(definition: ICommandLineStringListDefinition): CommandLineStringListParameter

- Inherited from KeyAction.defineStringListParameter

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:311

  Defines a command-line parameter whose argument is a single text string. The parameter can be specified multiple times to build a list.

  remarks

    Example usage of a string list parameter:

        example-tool --add file1.txt --add file2.txt --add file3.txt

  #### Parameters

  - ##### definition: ICommandLineStringListDefinition

  #### Returns CommandLineStringListParameter

### defineStringParameter

- defineStringParameter(definition: ICommandLineStringDefinition): CommandLineStringParameter

- Inherited from KeyAction.defineStringParameter

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:294

  Defines a command-line parameter whose argument is a single text string.

  remarks

    Example usage of a string parameter:

        example-tool --message "Hello, world!"

  #### Parameters

  - ##### definition: ICommandLineStringDefinition

  #### Returns CommandLineStringParameter

### execute

- execute(args?: string[]): Promise<boolean>

- Inherited from OpenTokenCLI.execute

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:427

  The program entry point will call this method to begin parsing command-line arguments and executing the corresponding action.

  remarks

    The returned promise will never reject: If an error occurs, it will be printed to stderr, process.exitCode will be set to 1, and the promise will resolve to false. This simplifies the most common usage scenario where the program entry point doesn't want to be involved with the command-line logic, and will discard the promise without a then() or catch() block.

    If your caller wants to trap and handle errors, use {@link CommandLineParser.executeWithoutErrorHandling} instead.

  #### Parameters

  - ##### Optional args: string[]

    the command-line arguments to be parsed; if omitted, then the process.argv will be used

  #### Returns Promise<boolean>

### executeWithoutErrorHandling

- executeWithoutErrorHandling(args?: string[]): Promise<void>

- Inherited from OpenTokenCLI.executeWithoutErrorHandling

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:432

  This is similar to {@link CommandLineParser.execute}, except that execution errors simply cause the promise to reject. It is the caller's responsibility to trap

  #### Parameters

  - ##### Optional args: string[]

  #### Returns Promise<void>

### getAction

- getAction(actionName: string): CommandLineAction

- Inherited from OpenTokenCLI.getAction

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:404

  Retrieves the action with the specified name. If no matching action is found, an exception is thrown.

  #### Parameters

  - ##### actionName: string

  #### Returns CommandLineAction

### getChoiceParameter

- getChoiceParameter(parameterLongName: string): CommandLineChoiceParameter

- Inherited from KeyAction.getChoiceParameter

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:251

  Returns the CommandLineChoiceParameter with the specified long name.

  remarks

    This method throws an exception if the parameter is not defined.

  #### Parameters

  - ##### parameterLongName: string

  #### Returns CommandLineChoiceParameter

### getFlagParameter

- getFlagParameter(parameterLongName: string): CommandLineFlagParameter

- Inherited from KeyAction.getFlagParameter

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:268

  Returns the CommandLineFlagParameter with the specified long name.

  remarks

    This method throws an exception if the parameter is not defined.

  #### Parameters

  - ##### parameterLongName: string

  #### Returns CommandLineFlagParameter

### getIntegerParameter

- getIntegerParameter(parameterLongName: string): CommandLineIntegerParameter

- Inherited from KeyAction.getIntegerParameter

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:284

  Returns the CommandLineIntegerParameter with the specified long name.

  remarks

    This method throws an exception if the parameter is not defined.

  #### Parameters

  - ##### parameterLongName: string

  #### Returns CommandLineIntegerParameter

### getStringListParameter

- getStringListParameter(parameterLongName: string): CommandLineStringListParameter

- Inherited from KeyAction.getStringListParameter

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:333

  Returns the CommandLineStringListParameter with the specified long name.

  remarks

    This method throws an exception if the parameter is not defined.

  #### Parameters

  - ##### parameterLongName: string

  #### Returns CommandLineStringListParameter

### getStringParameter

- getStringParameter(parameterLongName: string): CommandLineStringParameter

- Inherited from KeyAction.getStringParameter

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:300

  Returns the CommandLineStringParameter with the specified long name.

  remarks

    This method throws an exception if the parameter is not defined.

  #### Parameters

  - ##### parameterLongName: string

  #### Returns CommandLineStringParameter

### Protected onDefineParameters

- onDefineParameters(): void

- Overrides CommandLineParameterProvider.onDefineParameters

  - Defined in src/cli/OpenTokenCLI.ts:40

  #### Returns void

### Protected onExecute

- onExecute(): Promise<void>

- Overrides CommandLineParser.onExecute

  - Defined in src/cli/OpenTokenCLI.ts:48

  #### Returns Promise<void>

### renderHelpText

- renderHelpText(): string

- Inherited from KeyAction.renderHelpText

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:337

  Generates the command-line help text.

  #### Returns string

### tryGetAction

- tryGetAction(actionName: string): CommandLineAction | undefined

- Inherited from OpenTokenCLI.tryGetAction

  - Defined in node_modules/@rushstack/ts-command-line/dist/ts-command-line.d.ts:409

  Retrieves the action with the specified name. If no matching action is found, undefined is returned.

  #### Parameters

  - ##### actionName: string

  #### Returns CommandLineAction | undefined

Generated using TypeDoc