tweaking recursive help...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-01-24 16:10:12 +03:00
parent 9e53e80759
commit d9afd341de
2 changed files with 15 additions and 3 deletions

18
argv.js
View File

@ -268,7 +268,7 @@ module.presets = {
// //
// Parser(..) -> parser(..) -> result // Parser(..) -> parser(..) -> result
// //
// Parse(..) // Parser(..)
// - constructs a parser object (instance) // - constructs a parser object (instance)
// parser(..) // parser(..)
// - parse is instance of Parse // - parse is instance of Parse
@ -916,9 +916,21 @@ object.Constructor('Parser', {
// XXX REMOVE WHEN DONE... // XXX REMOVE WHEN DONE...
doc: false, doc: false,
handler: function(){ handler: function(){
// XXX print header but skip footer...
// XXX do we pass args here???
var res = this.handle('-help', ...arguments) var res = this.handle('-help', ...arguments)
// XXX print help for nested parsers... // print help for nested parsers...
// XXX for(var n in this){
if(this[n] instanceof Parser){
// XXX print different header and skip footer...
this.print([
'',
'',
'Command: '+ n.slice(1),
'',
].join('\n'))
// XXX skip footer...
this.handle(n, ['-help'], n.slice(1)) } }
return res } }, return res } },
// alias for convenience (not documented)... // alias for convenience (not documented)...
'-?': { '-?': {

0
test.js Normal file → Executable file
View File