mirror of
https://github.com/flynx/argv.js.git
synced 2025-10-28 18:30:07 +00:00
a bit better sub-command title style...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
de92caa190
commit
c9f99d9ce0
12
argv.js
12
argv.js
@ -702,6 +702,8 @@ object.Constructor('Parser', {
|
|||||||
footer: 'Written by: $AUTHOR\nVersion: $VERSION / License: $LICENSE',
|
footer: 'Written by: $AUTHOR\nVersion: $VERSION / License: $LICENSE',
|
||||||
|
|
||||||
helpExtendedCommandHeader: 'Command: $COMMAND',
|
helpExtendedCommandHeader: 'Command: $COMMAND',
|
||||||
|
// to disable set to false...
|
||||||
|
helpExtendedCommandHeaderUnderline: '-',
|
||||||
|
|
||||||
// NOTE: this supports but does not requires the 'colors' module...
|
// NOTE: this supports but does not requires the 'colors' module...
|
||||||
// XXX should wrap long lines...
|
// XXX should wrap long lines...
|
||||||
@ -970,14 +972,18 @@ object.Constructor('Parser', {
|
|||||||
// doc...
|
// doc...
|
||||||
if(this[n] instanceof Parser
|
if(this[n] instanceof Parser
|
||||||
&& this[n].doc !== false){
|
&& this[n].doc !== false){
|
||||||
|
var title
|
||||||
this.print([
|
this.print([
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
(this.helpExtendedCommandHeader
|
(title = (this.helpExtendedCommandHeader
|
||||||
?? 'Command: $COMMAND')
|
?? 'Command: $COMMAND')
|
||||||
.replace(/\$COMMAND/g, n.slice(1)),
|
.replace(/\$COMMAND/g, n.slice(1))),
|
||||||
|
this.helpExtendedCommandHeaderUnderline ?
|
||||||
|
title.replace(/./g, this.helpExtendedCommandHeaderUnderline)
|
||||||
|
: [],
|
||||||
'',
|
'',
|
||||||
].join('\n'))
|
].flat().join('\n'))
|
||||||
this.handle(n, ['-h=noFooter'], n.slice(1)) } }
|
this.handle(n, ['-h=noFooter'], n.slice(1)) } }
|
||||||
|
|
||||||
// footer...
|
// footer...
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ig-argv",
|
"name": "ig-argv",
|
||||||
"version": "2.16.8",
|
"version": "2.16.9",
|
||||||
"description": "simple argv parser",
|
"description": "simple argv parser",
|
||||||
"main": "argv.js",
|
"main": "argv.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user