-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine normalize and parseoptions, and update combined option handli…
…ng (#1152) * Add tests for Utility Conventions before changing code to match * Switch from preflight including normalise to just testing parseOptions * Only refactor known options Do the work in .parseOptions and delete single-pass .normalize * Add short flag processing to READMEm, and literal -- * Improve character description * Add a note that options not positional. * Remove regression tests for bug not really fixed by this * Add back #561 into known issues * Refactor to make a little clearer and symmetrical * Use template to construct strings consistently within parseOptions
- Loading branch information
1 parent
62234f6
commit 1691344
Showing
6 changed files
with
187 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
const commander = require('../'); | ||
|
||
describe('open issues', () => { | ||
// https://github.com/tj/commander.js/issues/561 | ||
test('#561: when specify argument and unknown option with no action handler then error', () => { | ||
const program = new commander.Command(); | ||
program | ||
.exitOverride() | ||
.option('-x, --x-flag', 'A flag') | ||
.arguments('<file>'); | ||
|
||
expect(() => { | ||
program.parse(['node', 'test', '1', '--NONSENSE', '2', '3']); | ||
}).toThrow(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters