dashdash
Advanced tools
Comparing version 1.12.1 to 1.12.2
@@ -753,2 +753,10 @@ /** | ||
* "examples/ddcompletion.js" for an example. | ||
* @param args.argtypes {Array} Optional. Array of completion types for | ||
* positional args (i.e. non-options). E.g. | ||
* argtypes = ['fruit', 'veggie', 'file'] | ||
* will result in completion of fruits for the first arg, veggies for the | ||
* second, and filenames for the third and subsequent positional args. | ||
* If not given, positional args will use Bash's 'default' completion. | ||
* See `specExtra` for providing Bash `complete_TYPE` functions, e.g. | ||
* `complete_fruit` and `complete_veggie` in this example. | ||
*/ | ||
@@ -759,2 +767,3 @@ Parser.prototype.bashCompletion = function bashCompletion(args) { | ||
assert.optionalString(args.specExtra, 'args.specExtra'); | ||
assert.optionalArrayOfString(args.argtypes, 'args.argtypes'); | ||
@@ -764,2 +773,3 @@ return bashCompletionFromOptions({ | ||
specExtra: args.specExtra, | ||
argtypes: args.argtypes, | ||
options: this.options | ||
@@ -797,2 +807,10 @@ }); | ||
* `hidden: true` attribute to exclude them from default help output. | ||
* @param args.argtypes {Array} Optional. Array of completion types for | ||
* positional args (i.e. non-options). E.g. | ||
* argtypes = ['fruit', 'veggie', 'file'] | ||
* will result in completion of fruits for the first arg, veggies for the | ||
* second, and filenames for the third and subsequent positional args. | ||
* If not given, positional args will use Bash's 'default' completion. | ||
* See `specExtra` for providing Bash `complete_TYPE` functions, e.g. | ||
* `complete_fruit` and `complete_veggie` in this example. | ||
*/ | ||
@@ -804,2 +822,3 @@ function bashCompletionSpecFromOptions(args) { | ||
assert.optionalBool(args.includeHidden, 'args.includeHidden'); | ||
assert.optionalArrayOfString(args.argtypes, 'args.argtypes'); | ||
@@ -859,3 +878,6 @@ var context = args.context || ''; | ||
context, optargs.sort().join(' '))); | ||
if (args.argtypes) { | ||
spec.push(format('local cmd%s_argtypes="%s"', | ||
context, args.argtypes.join(' '))); | ||
} | ||
return spec.join('\n'); | ||
@@ -874,2 +896,10 @@ } | ||
* "examples/ddcompletion.js" for an example. | ||
* @param args.argtypes {Array} Optional. Array of completion types for | ||
* positional args (i.e. non-options). E.g. | ||
* argtypes = ['fruit', 'veggie', 'file'] | ||
* will result in completion of fruits for the first arg, veggies for the | ||
* second, and filenames for the third and subsequent positional args. | ||
* If not given, positional args will use Bash's 'default' completion. | ||
* See `specExtra` for providing Bash `complete_TYPE` functions, e.g. | ||
* `complete_fruit` and `complete_veggie` in this example. | ||
*/ | ||
@@ -881,2 +911,3 @@ function bashCompletionFromOptions(args) { | ||
assert.optionalString(args.specExtra, 'args.specExtra'); | ||
assert.optionalArrayOfString(args.argtypes, 'args.argtypes'); | ||
@@ -887,3 +918,6 @@ // Gather template data. | ||
date: new Date(), | ||
spec: bashCompletionSpecFromOptions({options: args.options}) | ||
spec: bashCompletionSpecFromOptions({ | ||
options: args.options, | ||
argtypes: args.argtypes | ||
}), | ||
}; | ||
@@ -890,0 +924,0 @@ if (args.specExtra) { |
{ | ||
"name": "dashdash", | ||
"description": "A light, featureful and explicit option parsing library.", | ||
"version": "1.12.1", | ||
"version": "1.12.2", | ||
"author": "Trent Mick <trentm@gmail.com> (http://trentm.com)", | ||
@@ -14,3 +14,3 @@ "keywords": ["option", "parser", "parsing", "cli", "command", "args", | ||
"dependencies": { | ||
"assert-plus": "0.1.x" | ||
"assert-plus": "^0.2.0" | ||
}, | ||
@@ -17,0 +17,0 @@ "devDependencies": { |
@@ -275,7 +275,6 @@ A light, featureful and explicit option parsing library for node.js. | ||
<!-- | ||
TODO: document specExtra | ||
TODO: document includeHidden | ||
TODO: document custom types, `function complete_FOO` guide, completionType | ||
--> | ||
- TODO: document specExtra | ||
- TODO: document includeHidden | ||
- TODO: document custom types, `function complete\_FOO` guide, completionType | ||
- TODO: document argtypes | ||
@@ -282,0 +281,0 @@ |
Sorry, the diff of this file is not supported yet
67466
931
575
+ Addedassert-plus@0.2.0(transitive)
- Removedassert-plus@0.1.5(transitive)
Updatedassert-plus@^0.2.0