mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
18 lines
1.0 KiB
TypeScript
18 lines
1.0 KiB
TypeScript
// Type definitions for command-line-commands 2.0.0
|
|
// Project: https://github.com/75lb/command-line-commands
|
|
// Definitions by: CzBuCHi <https://github.com/CzBuCHi>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
/**
|
|
* Parses the `argv` value supplied (or `process.argv` by default), extracting and returning the `command` and remainder of `argv`. The command will be the first value in the `argv` array unless it is an option (e.g. `--help`).
|
|
*
|
|
* @param {string|string[]} - One or more command strings, one of which the user must supply. Include `null` to represent "no command" (effectively making a command optional).
|
|
* @param [argv] {string[]} - An argv array, defaults to the global `process.argv` if not supplied.
|
|
* @returns {{ command: string, argv: string[] }}
|
|
* @throws `INVALID_COMMAND` - user supplied a command not specified in `commands`.
|
|
*/
|
|
declare function commandLineCommands(commands: (string | null)[], argv?: string[]): { command: string | null, argv: string[] };
|
|
|
|
export = commandLineCommands;
|
|
|