Remove most uses of top-level, as less accurate now with command nesting. (#1230)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by John Gee · committed by GitHub · parent e960c90 · Browse files · 3 files·+7 added−7 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+7 added−7 removed
- other:+7 added−7 removed
Provenance
- Commit
2c0a237- Tree
e5b8cee- Author
John Gee <john@ruru.gen.nz>- Committer
GitHub <noreply@github.com>- Parent
e960c90
3 files changed+7 added−7 removed
modified:typings/index.d.ts+1 added-1 removed
101 unmodified lines102 */103 addCommand(cmd: Command): this;104 105 /**106- * Define argument syntax for the top-level command.106+ * Define argument syntax for command.107 *108 * @returns Command for chaining109 */110 arguments(desc: string): this;258 unmodified linesmodified:index.js+2 added-2 removed
151 unmodified lines152 *153 * @param {string} nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`154 * @param {Object|string} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)155 * @param {Object} [execOpts] - configuration options (for executable)156- * @return {Command} returns new command for action handler, or top-level command for executable command156+ * @return {Command} returns new command for action handler, or `this` for executable command157 * @api public158 */159 160 command(nameAndArgs, actionOptsOrExecDesc, execOpts) {79 unmodified lines240 return this;241 };242 243 /**244- * Define argument syntax for the top-level command.244+ * Define argument syntax for the command.245 *246 * @api public247 */248 1464 unmodified linesmodified:Readme.md+4 added-4 removed
298 unmodified lines299 ```300 301 ## Commands302 303-You can specify (sub)commands for your top-level command using `.command()` or `.addCommand()`. There are two ways these can be implemented: using an action handler attached to the command, or as a stand-alone executable file (described in more detail later). The subcommands may be nested ([example](./examples/nestedCommands.js)).303+You can specify (sub)commands using `.command()` or `.addCommand()`. There are two ways these can be implemented: using an action handler attached to the command, or as a stand-alone executable file (described in more detail later). The subcommands may be nested ([example](./examples/nestedCommands.js)).304 305 In the first parameter to `.command()` you specify the command name and any command arguments. The arguments may be `<required>` or `[optional]`, and the last argument may also be `variadic...`.306 307 You can use `.addCommand()` to add an already configured subcommand to the program.10 unmodified lines318 console.log('clone command called');319 });320 321 // Command implemented using stand-alone executable file (description is second parameter to `.command`)322-// Returns top-level command for adding more commands.322+// Returns `this` for adding more commands.323 program324 .command('start <service>', 'start named service')325 .command('stop [service]', 'stop named service, or all if no name supplied');326 327 // Command prepared separately.328-// Returns top-level command for adding more commands.328+// Returns `this` for adding more commands.329 program330 .addCommand(build.makeBuildCommand());331 ```332 333 Configuration options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the command from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified ([example](./examples/defaultCommand.js)).334 335 ### Specify the argument syntax336 337-You use `.arguments` to specify the arguments for the top-level command, and for subcommands they are included in the `.command` call. Angled brackets (e.g. `<required>`) indicate required input. Square brackets (e.g. `[optional]`) indicate optional input.337+You use `.arguments` to specify the arguments for the top-level command, and for subcommands they are usually included in the `.command` call. Angled brackets (e.g. `<required>`) indicate required input. Square brackets (e.g. `[optional]`) indicate optional input.338 339 ```js340 const { program } = require('commander');341 396 unmodified lines