Rush StackShopBlogEvents
Skip to main content

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

CommandLineAction class

Represents a sub-command that is part of the CommandLineParser command line. Applications should create subclasses of CommandLineAction 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).

Signature:

export declare abstract class CommandLineAction extends CommandLineParameterProvider 

Extends: CommandLineParameterProvider

Constructors

ConstructorModifiersDescription
(constructor)(options)Constructs a new instance of the CommandLineAction class

Properties

PropertyModifiersTypeDescription
actionNamereadonlystringThe name of the action. For example, if the tool is called "example", then the "build" action might be invoked as: "example build -q --some-other-option"
documentationreadonlystringA detailed description that is shown on the action help page, which is displayed by the command "example build --help", e.g. for actionName="build".
summaryreadonlystringA quick summary that is shown on the main help page, which is displayed by the command "example --help"

Methods

MethodModifiersDescription
onExecute()

protected

abstract

Your subclass should implement this hook to perform the operation.