Skip to content

Commit 3052437

Browse files
committed
Add verbose flag for more info
1 parent ee3252a commit 3052437

File tree

5 files changed

+13
-2
lines changed

5 files changed

+13
-2
lines changed

lib/parse-argv.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ export function parseArgv(flags, options) {
148148
assert(typeof config.silent === 'boolean')
149149
assert(typeof config['silently-ignore'] === 'boolean')
150150
assert(typeof config.tree === 'boolean')
151+
assert(typeof config.verbose === 'boolean')
151152
assert(typeof config.version === 'boolean')
152153
assert(typeof config.watch === 'boolean')
153154
assert(config.stdout === undefined || typeof config.stdout === 'boolean')
@@ -256,7 +257,8 @@ export function parseArgv(flags, options) {
256257
silentlyIgnore: config['silently-ignore'],
257258
tree: config.tree,
258259
treeIn: config['tree-in'],
259-
treeOut: config['tree-out']
260+
treeOut: config['tree-out'],
261+
verbose: config.verbose
260262
}
261263
}
262264
}

lib/schema.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ export const schema = [
175175
type: 'string',
176176
value: '<plugins>'
177177
},
178+
{
179+
common: true,
180+
default: false,
181+
description: 'report extra info for messages',
182+
long: 'verbose',
183+
type: 'boolean'
184+
},
178185
{
179186
default: false,
180187
description: 'output version number',

test/fixtures/example/HELP

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Options:
2727
--tree-in specify input as syntax tree
2828
--tree-out output syntax tree
2929
-u --use <plugins> use plugins
30+
--verbose report extra info for messages
3031
-v --version output version number
3132
-w --watch watch for changes and reprocess
3233

test/fixtures/example/LONG_FLAG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ Error: Unknown option `--no`, expected:
2222
--tree-in specify input as syntax tree
2323
--tree-out output syntax tree
2424
-u --use <plugins> use plugins
25+
--verbose report extra info for messages
2526
-v --version output version number
2627
-w --watch watch for changes and reprocess

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ test('args', async function (t) {
145145
const result = /** @type {ExecaError} */ (error)
146146

147147
assert.deepEqual(
148-
[result.exitCode, cleanError(result.stderr, 26)],
148+
[result.exitCode, cleanError(result.stderr, 27)],
149149
[1, longFlag]
150150
)
151151
}

0 commit comments

Comments
 (0)