a couple of experimental changes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-12-08 18:33:40 +03:00
parent 13c488850c
commit e3a3ce19f3
3 changed files with 9 additions and 4 deletions

View File

@ -320,6 +320,7 @@ object.Constructor('Parser', {
}, },
// XXX this does not merge the parse results... (???) // XXX this does not merge the parse results... (???)
// ...not sure how to do this yet...
// XXX splitting the high priority args should not work... // XXX splitting the high priority args should not work...
// XXX object.deepKeys(..) ??? // XXX object.deepKeys(..) ???
// XXX EXPERIMENTAL... // XXX EXPERIMENTAL...
@ -377,6 +378,7 @@ object.Constructor('Parser', {
.then(final) .then(final)
return pre[0] }, return pre[0] },
}, { }, {
// config... // config...
// //
@ -634,7 +636,7 @@ object.Constructor('Parser', {
|| dfl } || dfl }
return text return text
.replace(/\$AUTHOR/g, get('author', 'Author')) .replace(/\$AUTHOR/g, get('author', 'Author'))
.replace(/\$LICENSE/g, get('license', '')) .replace(/\$LICENSE/g, get('license', '-'))
.replace(/\$VERSION/g, get('version', '0.0.0')) .replace(/\$VERSION/g, get('version', '0.0.0'))
.replace(/\$SCRIPTNAME/g, this.scriptName) }, .replace(/\$SCRIPTNAME/g, this.scriptName) },
@ -1055,13 +1057,14 @@ object.Constructor('Parser', {
// prep argv... // prep argv...
var rest = parsed.rest = var rest = parsed.rest =
argv == null ? argv == null ?
(typeof(process) != 'unhandled' ? (typeof(process) != 'undefined' ?
process.argv process.argv
: []) : [])
: argv : argv
parsed.argv = rest.slice() parsed.argv = rest.slice()
main = main main = main
|| require.main.filename || (require.main || {}).filename
|| parsed.argv[1]
// nested command handler... // nested command handler...
var nested = parsed.nested = false var nested = parsed.nested = false
if(context instanceof Parser){ if(context instanceof Parser){

View File

@ -73,6 +73,8 @@ argv.Parser.chain({
doc: 'normal priority option', doc: 'normal priority option',
handler: function(){ handler: function(){
console.log('### normal priority option') }}, console.log('### normal priority option') }},
'@manual': parser,
}) })

View File

@ -1,6 +1,6 @@
{ {
"name": "ig-argv", "name": "ig-argv",
"version": "2.15.0", "version": "2.15.1",
"description": "simple argv parser", "description": "simple argv parser",
"main": "argv.js", "main": "argv.js",
"scripts": { "scripts": {