Home > @rushstack/ts-command-line
ts-command-line package
An object-oriented command-line parser for TypeScript projects.
Classes
Abstract Classes
Abstract Class | Description |
---|---|
CommandLineAction | 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). |
CommandLineParameter | The base class for the various command-line parameter types. |
CommandLineParameterProvider | This is the common base class for CommandLineAction and CommandLineParser that provides functionality for defining command-line parameters. |
CommandLineParameterWithArgument | The common base class for parameters types that receive an argument. |
CommandLineParser | The "argparse" library is a relatively advanced command-line parser with features such as word-wrapping and intelligible error messages (that are lacking in other similar libraries such as commander, yargs, and nomnom). Unfortunately, its ruby-inspired API is awkward to use. The abstract base classes CommandLineParser and CommandLineAction provide a wrapper for "argparse" that makes defining and consuming arguments quick and simple, and enforces that appropriate documentation is provided for each parameter. |
ScopedCommandLineAction | 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". |
Enumerations
Enumeration | Description |
---|---|
CommandLineConstants | String constants for command line processing. |
CommandLineParameterKind | Identifies the kind of a CommandLineParameter. |
Interfaces
Interface | Description |
---|---|
IAliasCommandLineActionOptions | Options for the AliasCommandLineAction constructor. |
IBaseCommandLineDefinition | For use with CommandLineParser, this interface represents a generic command-line parameter |
IBaseCommandLineDefinitionWithArgument | The common base interface for parameter types that accept an argument. |
ICommandLineActionOptions | Options for the CommandLineAction constructor. |
ICommandLineChoiceDefinition | For use with CommandLineParameterProvider.defineChoiceParameter(), this interface defines a command line parameter which is constrained to a list of possible options. |
ICommandLineChoiceListDefinition | For use with CommandLineParameterProvider.defineChoiceListParameter(), this interface defines a command line parameter which is constrained to a list of possible options. The parameter can be specified multiple times to build a list. |
ICommandLineFlagDefinition | For use with CommandLineParameterProvider.defineFlagParameter(), this interface defines a command line parameter that is a boolean flag. |
ICommandLineIntegerDefinition | For use with CommandLineParameterProvider.defineIntegerParameter(), this interface defines a command line parameter whose argument is an integer value. |
ICommandLineIntegerListDefinition | For use with CommandLineParameterProvider.defineIntegerListParameter(), this interface defines a command line parameter whose argument is an integer value. The parameter can be specified multiple times to build a list. |
ICommandLineParserOptions | Options for the CommandLineParser constructor. |
ICommandLineRemainderDefinition | For use with CommandLineParameterProvider.defineCommandLineRemainder(), this interface defines a rule that captures any remaining command line arguments after the recognized portion. |
ICommandLineStringDefinition | For use with CommandLineParameterProvider.defineStringParameter(), this interface defines a command line parameter whose argument is a string value. |
ICommandLineStringListDefinition | For use with CommandLineParameterProvider.defineStringListParameter(), this interface defines a command line parameter whose argument is a single text string. The parameter can be specified multiple times to build a list. |
IScopedLongNameParseResult | The result containing the parsed paramter long name and scope. Returned when calling CommandLineParameterProvider.parseScopedLongName(). |