Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/ts-command-line > ScopedCommandLineAction

ScopedCommandLineAction class

Represents a sub-command that is part of the CommandLineParser command-line. Applications should create subclasses of ScopedCommandLineAction corresponding to each action that they want to expose.

The action name should be comprised of lower case words separated by hyphens or colons. The name should include an English verb (e.g. "deploy"). Use a hyphen to separate words (e.g. "upload-docs"). A group of related commands can be prefixed with a colon (e.g. "docs:generate", "docs:deploy", "docs:serve", etc).

Scoped commands allow for different parameters to be specified for different provided scoping values. For example, the "scoped-action --scope A" command may allow for different scoped arguments to be specified than the "scoped-action --scope B" command.

Scoped arguments are specified after the "--" pseudo-argument. For example, "scoped-action --scope A -- --scopedFoo --scopedBar".

Signature:

export declare abstract class ScopedCommandLineAction extends CommandLineAction 

Extends: CommandLineAction

Constructors

Constructor

Modifiers

Description

(constructor)(options)

Constructs a new instance of the ScopedCommandLineAction class

Properties

Property

Modifiers

Type

Description

parameters

readonly

ReadonlyArray<CommandLineParameter>

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

ScopingParameterGroup

static

readonly

typeof SCOPING_PARAMETER_GROUP

The required group name to apply to all scoping parameters. At least one parameter must be defined with this group name.

Methods

Method

Modifiers

Description

onDefineScopedParameters(scopedParameterProvider)

protected

abstract

The child class should implement this hook to define its scoped command-line parameters, e.g. by calling scopedParameterProvider.defineFlagParameter(). These parameters will only be available if the action is invoked with a scope.

onExecuteAsync()

protected

abstract

Your subclass should implement this hook to perform the operation.