mirror of
https://github.com/flynx/argv.js.git
synced 2025-10-29 18:50:09 +00:00
testing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
73e1f82c5e
commit
fd2eb0e0ed
18
argv.js
18
argv.js
@ -187,29 +187,21 @@ function(name, pre, post){
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
// NOTE: currently any "argument" that passes the .optionInputPattern test
|
||||||
|
// is handled as an option, no matter what the prefix, so different
|
||||||
|
// prefixes can be handled by the handler by checking the key argument.
|
||||||
|
// currently both '-' and '+' are supported.
|
||||||
//
|
//
|
||||||
// NOTE: essentially this parser is a very basic stack language...
|
// NOTE: essentially this parser is a very basic stack language...
|
||||||
// XXX can we implement the whole thing directly as a stack language???
|
// XXX can we implement the whole thing directly as a stack language???
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// XXX FEATURE: handle <scriptName>-<command> script calls...
|
// XXX FEATURE (DELAYED): handle <scriptName>-<command> script calls...
|
||||||
//
|
|
||||||
// XXX FEATURE (DELAYED): read metadata from package.json...
|
// XXX FEATURE (DELAYED): read metadata from package.json...
|
||||||
// ...not clear which package json to get, needs more thought...
|
// ...not clear which package json to get, needs more thought...
|
||||||
// XXX FEATURE (DELAYED): handle multiple values per flag...
|
// XXX FEATURE (DELAYED): handle multiple values per flag...
|
||||||
// ...manually this is trivial, automating it would complicate things,
|
// ...manually this is trivial, automating it would complicate things,
|
||||||
// will think about it when we need this feature more than once...
|
// will think about it when we need this feature more than once...
|
||||||
// XXX FEATURE (DELAYED): multiple prefixes, like '+' and the like...
|
|
||||||
// ...one way to do this manualy now is to set the appropriate
|
|
||||||
// .optionInputPattern and handle the arg in the handler itself...
|
|
||||||
// ...not sure yet how to automate this:
|
|
||||||
// - prefix handler -- pass the prefix to a special handler and
|
|
||||||
// it decides what to do...
|
|
||||||
// -help -> this.handlePrefix('-', ...)
|
|
||||||
// - option prefix derived from arg prefix i.e.
|
|
||||||
// -help -> this['-help'](..)
|
|
||||||
// +help -> this['+help'](..)
|
|
||||||
//
|
|
||||||
//
|
//
|
||||||
// XXX add support for ParserError exception handling...
|
// XXX add support for ParserError exception handling...
|
||||||
// XXX should -help should work for any command? ..not just nested parsers?
|
// XXX should -help should work for any command? ..not just nested parsers?
|
||||||
|
|||||||
5
test.js
5
test.js
@ -46,6 +46,11 @@ argv.Parser({
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'-prefix': {
|
||||||
|
doc: 'prefix test',
|
||||||
|
handler: function(opts, key, value){
|
||||||
|
console.log('PREFIX:', key[0]) }, },
|
||||||
|
|
||||||
'-value': {
|
'-value': {
|
||||||
doc: 'Value option',
|
doc: 'Value option',
|
||||||
arg: 'VALUE | valueValue',
|
arg: 'VALUE | valueValue',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user