Skip to content
Myr

Fix order of nested parent commands in help

Before adoption: this commit came in with the history the project adopted, so no landing records it.

- fix multiple parent order (although multiple levels not yet supported) - without using any new javascript features

authored by John Gee · committed by John Gee · parent 23ddb56 · Browse files · 1 file+5 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−4 removed

  • other:+5 added−4 removed

1 file+5 added−4 removed

modified:index.js+5 added-4 removed
1114 unmodified lines
1115 var cmdName = this._name;1116 if (this._alias) {1117 cmdName = cmdName + '|' + this._alias;1118 }1119 var ancestor = this;1120 var prefix = [];1121 while ((ancestor = ancestor.parent)) prefix.push(ancestor.name() + ' ');1119 var parentCmdNames = '';1120 for (var parentCmd = this.parent; parentCmd; parentCmd = parentCmd.parent) {1121 parentCmdNames = parentCmd.name() + ' ' + parentCmdNames;1122 }1123 var usage = [1123 'Usage: ' + prefix.join('') + cmdName + ' ' + this.usage(),1124 'Usage: ' + parentCmdNames + cmdName + ' ' + this.usage(),1125 ''1126 ];11271128 var cmds = [];
119 unmodified lines