Skip to content

Commit

Permalink
Add verbose flag for more info
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 21, 2023
1 parent ee3252a commit 3052437
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/parse-argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export function parseArgv(flags, options) {
assert(typeof config.silent === 'boolean')
assert(typeof config['silently-ignore'] === 'boolean')
assert(typeof config.tree === 'boolean')
assert(typeof config.verbose === 'boolean')
assert(typeof config.version === 'boolean')
assert(typeof config.watch === 'boolean')
assert(config.stdout === undefined || typeof config.stdout === 'boolean')
Expand Down Expand Up @@ -256,7 +257,8 @@ export function parseArgv(flags, options) {
silentlyIgnore: config['silently-ignore'],
tree: config.tree,
treeIn: config['tree-in'],
treeOut: config['tree-out']
treeOut: config['tree-out'],
verbose: config.verbose
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions lib/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ export const schema = [
type: 'string',
value: '<plugins>'
},
{
common: true,
default: false,
description: 'report extra info for messages',
long: 'verbose',
type: 'boolean'
},
{
default: false,
description: 'output version number',
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/example/HELP
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Options:
--tree-in specify input as syntax tree
--tree-out output syntax tree
-u --use <plugins> use plugins
--verbose report extra info for messages
-v --version output version number
-w --watch watch for changes and reprocess

Expand Down
1 change: 1 addition & 0 deletions test/fixtures/example/LONG_FLAG
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ Error: Unknown option `--no`, expected:
--tree-in specify input as syntax tree
--tree-out output syntax tree
-u --use <plugins> use plugins
--verbose report extra info for messages
-v --version output version number
-w --watch watch for changes and reprocess
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ test('args', async function (t) {
const result = /** @type {ExecaError} */ (error)

assert.deepEqual(
[result.exitCode, cleanError(result.stderr, 26)],
[result.exitCode, cleanError(result.stderr, 27)],
[1, longFlag]
)
}
Expand Down

0 comments on commit 3052437

Please sign in to comment.