Merge branch 'develop' into release/5.x
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by John Gee · committed by John Gee · parents 3ab2196, d5186ba · Browse files · 5 files·+25 added−3 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+25 added−3 removed
- other:+25 added−3 removed
Provenance
- Commit
cb84f6e- Tree
6694003- Author
John Gee <john@ruru.gen.nz>- Committer
John Gee <john@ruru.gen.nz>- Parent 1
3ab2196- Parent 2
d5186ba
5 files changed+25 added−3 removed
modified:.github/workflows/tests.yml+1 added-1 removed
17 unmodified lines1819202122222324252617 unmodified lines with: node-version: ${{ matrix.node-version }} # Use separate run commands so command status handled correctly on Windows - name: npm install run: npm install run: npm ci - name: npm test run: npm test - name: npm run lint run: npm run lintadded:.github/FUNDING.yml+2 added
12github: [tj, shadowspawn, abetomo]tidelift: npm/commandermodified:typings/commander-tests.ts+13 added-1 removed
43 unmodified lines4445464748495051525354555657585956 unmodified lines11611711811911212012112212312412512612712812926 unmodified lines43 unmodified linesfunction increaseVerbosity(v: any, total: number) { return total + 1;}
function syncCall() { console.log("Sync success!");}
async function asyncCall() { return;}
program .version('0.0.1') .usage('[options] <file ...>') .option('-i, --integer <n>', 'An integer argument', parseInt)56 unmodified lines });
program .command("name1", "description") .command("name2", "description", { isDefault:true }) .command("name2", "description", { isDefault:true });
program .command("name3").action(syncCall) .command("name4").action(asyncCall);
const preparedCommand = new program.Command('prepared');program.addCommand(preparedCommand);
program26 unmodified linesmodified:typings/index.d.ts+1 added-1 removed
109 unmodified lines110 * });111 *112 * @returns Command for chaining113 */114- action(fn: (...args: any[]) => void): Command;114+ action(fn: (...args: any[]) => void | Promise<void>): Command;115 116 /**117 * Define option with `flags`, `description` and optional118 * coercion `fn`.210 unmodified linesmodified:CHANGELOG.md+8 added
59 unmodified lines60 If you use `program.args` or more complicated tests to detect a missing subcommand, you may be able to delete the code and rely on the default behaviour.61 62 If you use `.command('*')` to add a default command, you may be be able to switch to `isDefault:true` with a named command.63 64+## [4.1.1] (2020-02-02)65+66+### Fixed67+68+* TypeScript definition for `.action()` should include Promise for async ([#1157])69+70 ## [4.1.0] (2020-01-06)71 72 ### Added73 420 unmodified lines494 [#1145]: https://github.com/tj/commander.js/pull/1145495 [#1146]: https://github.com/tj/commander.js/pull/1146496 [#1149]: https://github.com/tj/commander.js/pull/1149497 [#1153]: https://github.com/tj/commander.js/issues/1153498+[#1157]: https://github.com/tj/commander.js/pull/1157499 [#1159]: https://github.com/tj/commander.js/pull/1159500 501 [Unreleased]: https://github.com/tj/commander.js/compare/master...develop502 [5.0.0-0]: https://github.com/tj/commander.js/compare/v4.2.o..v5.0.0-0503+[4.1.1]: https://github.com/tj/commander.js/compare/v4.0.0..v4.1.1504 [4.1.0]: https://github.com/tj/commander.js/compare/v4.0.1..v4.1.0505 [4.0.1]: https://github.com/tj/commander.js/compare/v4.0.0..v4.0.1506 [4.0.0]: https://github.com/tj/commander.js/compare/v3.0.2..v4.0.0507 [4.0.0-1]: https://github.com/tj/commander.js/compare/v4.0.0-0..v4.0.0-15 unmodified lines