Skip to content

Commit

Permalink
Merge branch 'develop' into release/13.x
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn committed Nov 10, 2024
2 parents 966720a + c0afc31 commit 5a79585
Show file tree
Hide file tree
Showing 16 changed files with 270 additions and 191 deletions.
6 changes: 2 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Pull Request

<!--
The text in these markdown comments is instructions that will not appear in the displayed pull request,
and can be deleted.
Expand All @@ -10,10 +8,10 @@ Follow the existing code style. Check the tests succeed, including format and li
npm run test
npm run check
Don't update the CHANGELOG or command version number. That gets done by maintainers when preparing the release.
Don't update the CHANGELOG or package version number. That gets done by maintainers when preparing the release.
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.
add a dependency are much less likely to be accepted, and we are likely to ask for alternative approaches to avoid the dependency.
-->

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

Expand Down Expand Up @@ -1183,7 +1183,7 @@ program

## 0.2.0 / 2011-09-26

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

## 0.1.0 / 2011-08-24

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ you should say so in your comments so we focus on the concept first before talki
- README
- examples/

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.
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.

- <https://devrant.com/rants/1854993/package-tsunami>
- <https://dev.to/leoat12/the-nodemodules-problem-29dc>
2 changes: 1 addition & 1 deletion docs/zh-CN/不再推荐使用的功能.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ program.option('-c,--coffee <type>', 'coffee', /short-white|long-black/);
此选项曾被用作传入`.command()`方法,以在内建的帮助信息中隐藏该命令:

```js
program.command('example', 'examnple command', { noHelp: true });
program.command('example', 'example command', { noHelp: true });
```

在 Commander v5.1 中,该选项被更名为`hidden`。自 Commander v7 起`noHelp`不再推荐使用。
Expand Down
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = tseslint.config(
},
rules: {
'@typescript-eslint/no-var-requires': 'off', // tseslint does not autodetect commonjs context
'@typescript-eslint/no-require-imports': 'off', // tseslint does not autodetect commonjs context
},
},
{
Expand Down
8 changes: 4 additions & 4 deletions examples/custom-command-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CommandWithTrace extends commander.Command {
}
}

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

program
.command('serve [params...]')
.option('-p, --port <number>', 'port number')
.action((params, options, command) => {
inpectCommand(command);
inspectCommand(command);
});

program.command('build <target>').action((buildTarget, options, command) => {
inpectCommand(command);
inspectCommand(command);
});

program.parse();
Expand Down
2 changes: 1 addition & 1 deletion lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
let resolvedScriptPath; // resolve possible symlink for installed npm binary
try {
resolvedScriptPath = fs.realpathSync(this._scriptPath);
} catch (err) {
} catch {
resolvedScriptPath = this._scriptPath;
}
executableDir = path.resolve(
Expand Down
6 changes: 3 additions & 3 deletions lib/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,11 @@ class Help {
);
}
if (extraInfo.length > 0) {
const extraDescripton = `(${extraInfo.join(', ')})`;
const extraDescription = `(${extraInfo.join(', ')})`;
if (argument.description) {
return `${argument.description} ${extraDescripton}`;
return `${argument.description} ${extraDescription}`;
}
return extraDescripton;
return extraDescription;
}
return argument.description;
}
Expand Down
7 changes: 5 additions & 2 deletions lib/option.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,16 @@ class Option {

/**
* Return option name, in a camelcase format that can be used
* as a object attribute key.
* as an object attribute key.
*
* @return {string}
*/

attributeName() {
return camelcase(this.name().replace(/^no-/, ''));
if (this.negate) {
return camelcase(this.name().replace(/^no-/, ''));
}
return camelcase(this.name());
}

/**
Expand Down
Loading

0 comments on commit 5a79585

Please sign in to comment.