bandersnatch
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -16,2 +16,9 @@ import { Argv, Arguments as BaseArguments } from 'yargs'; | ||
description?: string; | ||
/** | ||
* When set to true, creates a hidden command not visible in autocomplete or | ||
* help output. Can also be set by calling `command(...).hidden()`. | ||
* | ||
* Default to `false`. | ||
*/ | ||
hidden?: boolean; | ||
}; | ||
@@ -38,2 +45,7 @@ declare type CommandRunner = (command: string) => Promise<unknown>; | ||
/** | ||
* Marks the command as hidden, i.e. not visible in autocomplete or help | ||
* output. | ||
*/ | ||
hidden(): this; | ||
/** | ||
* Adds a new positional argument to the command. | ||
@@ -40,0 +52,0 @@ * This is shorthand for `.add(argument(...))` |
@@ -48,2 +48,10 @@ "use strict"; | ||
/** | ||
* Marks the command as hidden, i.e. not visible in autocomplete or help | ||
* output. | ||
*/ | ||
hidden() { | ||
this.options.hidden = true; | ||
return this; | ||
} | ||
/** | ||
* Adds a new positional argument to the command. | ||
@@ -152,3 +160,3 @@ * This is shorthand for `.add(argument(...))` | ||
aliases: [], | ||
describe: this.options.description || '', | ||
describe: this.options.hidden ? false : this.options.description || '', | ||
builder: this.getBuilder(commandRunner), | ||
@@ -155,0 +163,0 @@ handler: this.getHandler(commandRunner), |
{ | ||
"name": "bandersnatch", | ||
"description": "Simple TypeScript CLI / REPL framework", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"repository": { | ||
@@ -47,3 +47,3 @@ "type": "git", | ||
"@types/jest": "26.0.4", | ||
"@types/node": "14.0.18", | ||
"@types/node": "14.0.20", | ||
"doctoc": "1.4.0", | ||
@@ -50,0 +50,0 @@ "husky": "4.2.5", |
@@ -50,2 +50,4 @@ # bandersnatch | ||
- [`command(name, options)`](#commandname-options) | ||
- [`command.description(description)`](#commanddescriptiondescription) | ||
- [`command.hidden()`](#commandhidden) | ||
- [`command.argument(name, options)`](#commandargumentname-options) | ||
@@ -313,3 +315,3 @@ - [`command.option(name, options)`](#commandoptionname-options) | ||
- `description` (string, optional) is used in --help output. | ||
- `description` (string, optional) is used in help output. | ||
- `prompt` (string, default: `>`) use this prompt prefix when in REPL mode. | ||
@@ -323,3 +325,3 @@ - `help` (boolean, default: true) adds `help` and `--help` to the program which | ||
Sets the program description (string, required) used in --help output. | ||
Sets the program description (string, required) used in help output. | ||
@@ -399,4 +401,13 @@ #### `program.prompt(prompt)` | ||
- Options (object, optional) can contain these keys: | ||
- `description` (string, optional) is used in --help output. | ||
- `description` (string) is used in help output. | ||
- `hidden` (boolean) hide command from help output and autocomplete. | ||
#### `command.description(description)` | ||
Sets the command description (string, required) used in help output. | ||
#### `command.hidden()` | ||
Hide command from help output and autocomplete. | ||
#### `command.argument(name, options)` | ||
@@ -409,3 +420,3 @@ | ||
any of these keys: | ||
- `description` (string) is used in --help output. | ||
- `description` (string) is used in help output. | ||
- `optional` (boolean) makes this argument optional. | ||
@@ -432,3 +443,3 @@ - `variadic` (boolean) eagerly take all remaining arguments and parse as an | ||
option. Object with any of these keys: | ||
- `description` (string, optional) is used in --help output. | ||
- `description` (string, optional) is used in help output. | ||
- `type` (string) one of `"array"|"boolean"|"count"|"number"|"string"` which | ||
@@ -670,2 +681,4 @@ determines the runtime type of the argument. Use count for the number of | ||
- [ ] Better code coverage | ||
- [ ] Consider resolving ambiguity in _prompt_ param/method | ||
- [ ] Async autocomplete method | ||
- [ ] Choices autocompletion in REPL mode (open upstream PR in yargs) | ||
@@ -672,0 +685,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60270
1168
703