Home Manual Reference Source Test
import Command from 'atscm-cli/src/lib/cli/Command.js'
public class | source

Command

A command that can be run through the CLI.

Test:

Constructor Summary

Public Constructor
public

constructor(name: string, description: string, options: Object)

Creates a new Command with the given name and options.

Member Summary

Public Members
public get

The minimum and maximum number of (non-option) arguments the command handles.

public

The command descriptions.

public

The command's name.

public get

The options available for the command.

public get

If an error should be thrown for unknown arguments.

public get

Returns the usage string for the command.

Private Members
private

The command's raw options.

Method Summary

Public Methods
public

Returns true if the command requires a Liftoff.Environment before it can be run.

public

run(cli: AtSCMCli)

Runs the command with the current Cli instance.

Public Constructors

public constructor(name: string, description: string, options: Object) source

Creates a new Command with the given name and options.

Params:

NameTypeAttributeDescription
name string

The command's name.

description string

The command's description.

options Object

The options to apply.

options.options Map<string, Option>

The options available for this command.

options.arguments string
  • optional

The command's argument string. See yargs' documentation for details.

options.minArguments number
  • optional

The minimum number or (non-option) arguments the command requires.

options.maxArguments number
  • optional

The maximum number or (non-option) arguments the command requires.

options.strict boolean
  • optional
  • default: true

Throw error for unknown arguments.

Throw:

Error

Throws an error if options.maxArguments is less than options.minArguments.

Test:

See:

Public Members

public get demandCommand: number[] source

The minimum and maximum number of (non-option) arguments the command handles.

Test:

public description: String source

The command descriptions.

public name: String source

The command's name.

public get options: Map<string, Option> source

The options available for the command.

Test:

public get strict: boolean source

If an error should be thrown for unknown arguments.

Test:

public get usage: string source

Returns the usage string for the command. Something like "{name} {arguments}".

Test:

Private Members

private _options: Object source

The command's raw options.

Public Methods

public requiresEnvironment(cli: AtSCMCli): boolean source

Returns true if the command requires a Liftoff.Environment before it can be run.

Params:

NameTypeAttributeDescription
cli AtSCMCli

The current cli instance.

Return:

boolean

true if the command requires a Liftoff.Environment.

public run(cli: AtSCMCli) source

Runs the command with the current Cli instance. Asynchronous commands should return a Promise here..

Params:

NameTypeAttributeDescription
cli AtSCMCli

The current cli instance.

Test: