Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Tools for creating interactive command line tools
Classes
A spinner that can be used to indicate that something is loading.
Functions
Take a set of command line arguments, optionally with a set of options, and return an object representing the flags found in the passed arguments.
Shows the given message and waits for the user's input. Returns the user's input as string.
This is similar to prompt() but it print user's input as * to prevent password from being shown.
Use an empty mask if you don't want to show any character.
Interfaces
The options for the parseArgs call.
- --: TDoubleDash
When
true, populate the result_with everything before the--and the result['--']with everything after the--. - alias: TAliases
An object mapping string names to strings or arrays of string argument names to use as aliases.
- boolean: TBooleans | ReadonlyArray<Extract<TBooleans, string>>
A boolean, string or array of strings to always treat as booleans. If
truewill treat all double hyphenated arguments without equal signs asboolean(e.g. affects--foo, not-for--foo=bar). Allbooleanarguments will be set tofalseby default. - collect: TCollectable | ReadonlyArray<Extract<TCollectable, string>>
A string or array of strings argument names to always treat as arrays. Collectable options can be used multiple times. All values will be collected into one array. If a non-collectable option is used multiple times, the last value is used. All Collectable arguments will be set to
[]by default. - default: TDefault & Defaults<TBooleans, TStrings>
An object mapping string argument names to default values.
- negatable: TNegatable | ReadonlyArray<Extract<TNegatable, string>>
A string or array of strings argument names which can be negated by prefixing them with
--no-, like--no-config. - stopEarly: boolean
When
true, populate the result_with everything after the first non-option. - string: TStrings | ReadonlyArray<Extract<TStrings, string>>
A string or array of strings argument names to always treat as strings.
- unknown: () => unknownarg: string,key?: string,value?: unknown
A function which is invoked with a command line parameter not defined in the
optionsconfiguration object. If the function returnsfalse, the unknown option is not added toparsedArgs.
Options for Spinner.
- color: Color
The color of the spinner. Defaults to the default terminal color. This can be changed while the spinner is active.
- interval: number
The time between each frame of the spinner in milliseconds.
- message: string
The message to display next to the spinner. This can be changed while the spinner is active.
- spinner: string[]
The sequence of characters to be iterated through for animation.
Type Aliases
This is a hack to allow us to use the same type for both the color name and an ANSI escape code.
& { _: Array<string | number>; }
& (boolean extends TDoubleDash ? DoubleDash : true extends TDoubleDash ? Required<DoubleDash> : Record<never, never>)
The value returned from parseArgs.
| "red"
| "green"
| "yellow"
| "blue"
| "magenta"
| "cyan"
| "white"
| "gray"
| Ansi
Color options for SpinnerOptions.color.
Options for promptSecret.