Skip to content

Commit 5a79585

Browse files
committed
Merge branch 'develop' into release/13.x
2 parents 966720a + c0afc31 commit 5a79585

16 files changed

+270
-191
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Pull Request
2-
31
<!--
42
The text in these markdown comments is instructions that will not appear in the displayed pull request,
53
and can be deleted.
@@ -10,10 +8,10 @@ Follow the existing code style. Check the tests succeed, including format and li
108
npm run test
119
npm run check
1210
13-
Don't update the CHANGELOG or command version number. That gets done by maintainers when preparing the release.
11+
Don't update the CHANGELOG or package version number. That gets done by maintainers when preparing the release.
1412
1513
Commander currently has zero production dependencies. That isn't a hard requirement, but is a simple story. Requests which
16-
add a dependency are much less likely to be accepted, and we are likely to ask if there alternative approaches to avoid the dependency.
14+
add a dependency are much less likely to be accepted, and we are likely to ask for alternative approaches to avoid the dependency.
1715
-->
1816

1917
## Problem

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ A couple of configuration problems now throw an error, which will pick up issues
360360
- *Breaking:* `CommanderError` code `commander.invalidOptionArgument` renamed `commander.invalidArgument` ([#1508])
361361
- *Breaking:* TypeScript declaration for `.addTextHelp()` callback no longer allows result of `undefined`, now just `string` ([#1516])
362362
- refactor `index.tab` into a file per class ([#1522])
363-
- remove help suggestion from "unknown command" error message (see `.showHelpAfteError()`) ([#1534])
363+
- remove help suggestion from "unknown command" error message (see `.showHelpAfterError()`) ([#1534])
364364
- `Command` property `.arg` initialised to empty array (was previously undefined) ([#1529])
365365
- update dependencies
366366

@@ -1183,7 +1183,7 @@ program
11831183

11841184
## 0.2.0 / 2011-09-26
11851185

1186-
* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
1186+
* Allow for defaults that are not just boolean. Default reassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
11871187

11881188
## 0.1.0 / 2011-08-24
11891189

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ you should say so in your comments so we focus on the concept first before talki
3737
- README
3838
- examples/
3939

40-
Commander currently has zero production dependencies. That isn't a hard requirement, but is a simple story. Requests which add a dependency are much less likely to be accepted, and we are likely to ask if there alternative approaches to avoid the dependency.
40+
Commander currently has zero production dependencies. That isn't a hard requirement, but is a simple story. Requests which add a dependency are much less likely to be accepted, and we are likely to ask for alternative approaches to avoid the dependency.
4141

4242
- <https://devrant.com/rants/1854993/package-tsunami>
4343
- <https://dev.to/leoat12/the-nodemodules-problem-29dc>

docs/zh-CN/不再推荐使用的功能.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ program.option('-c,--coffee <type>', 'coffee', /short-white|long-black/);
3232
此选项曾被用作传入`.command()`方法,以在内建的帮助信息中隐藏该命令:
3333

3434
```js
35-
program.command('example', 'examnple command', { noHelp: true });
35+
program.command('example', 'example command', { noHelp: true });
3636
```
3737

3838
在 Commander v5.1 中,该选项被更名为`hidden`。自 Commander v7 起`noHelp`不再推荐使用。

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ module.exports = tseslint.config(
2222
},
2323
rules: {
2424
'@typescript-eslint/no-var-requires': 'off', // tseslint does not autodetect commonjs context
25+
'@typescript-eslint/no-require-imports': 'off', // tseslint does not autodetect commonjs context
2526
},
2627
},
2728
{

examples/custom-command-class.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class CommandWithTrace extends commander.Command {
1212
}
1313
}
1414

15-
function inpectCommand(command) {
15+
function inspectCommand(command) {
1616
// The option value is stored as property on command because we called .storeOptionsAsProperties()
1717
console.log(`Called '${command.name()}'`);
1818
console.log(`args: ${command.args}`);
@@ -22,18 +22,18 @@ function inpectCommand(command) {
2222
const program = new CommandWithTrace('program')
2323
.option('-v, ---verbose')
2424
.action((options, command) => {
25-
inpectCommand(command);
25+
inspectCommand(command);
2626
});
2727

2828
program
2929
.command('serve [params...]')
3030
.option('-p, --port <number>', 'port number')
3131
.action((params, options, command) => {
32-
inpectCommand(command);
32+
inspectCommand(command);
3333
});
3434

3535
program.command('build <target>').action((buildTarget, options, command) => {
36-
inpectCommand(command);
36+
inspectCommand(command);
3737
});
3838

3939
program.parse();

lib/command.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
11341134
let resolvedScriptPath; // resolve possible symlink for installed npm binary
11351135
try {
11361136
resolvedScriptPath = fs.realpathSync(this._scriptPath);
1137-
} catch (err) {
1137+
} catch {
11381138
resolvedScriptPath = this._scriptPath;
11391139
}
11401140
executableDir = path.resolve(

lib/help.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,11 @@ class Help {
350350
);
351351
}
352352
if (extraInfo.length > 0) {
353-
const extraDescripton = `(${extraInfo.join(', ')})`;
353+
const extraDescription = `(${extraInfo.join(', ')})`;
354354
if (argument.description) {
355-
return `${argument.description} ${extraDescripton}`;
355+
return `${argument.description} ${extraDescription}`;
356356
}
357-
return extraDescripton;
357+
return extraDescription;
358358
}
359359
return argument.description;
360360
}

lib/option.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,16 @@ class Option {
207207

208208
/**
209209
* Return option name, in a camelcase format that can be used
210-
* as a object attribute key.
210+
* as an object attribute key.
211211
*
212212
* @return {string}
213213
*/
214214

215215
attributeName() {
216-
return camelcase(this.name().replace(/^no-/, ''));
216+
if (this.negate) {
217+
return camelcase(this.name().replace(/^no-/, ''));
218+
}
219+
return camelcase(this.name());
217220
}
218221

219222
/**

0 commit comments

Comments
 (0)