* Get the command usage to be displayed at the top of the built-in help. * * @param {Command} cmd * @returns {string}
(cmd)
| 275 | */ |
| 276 | |
| 277 | commandUsage(cmd) { |
| 278 | // Usage |
| 279 | let cmdName = cmd._name; |
| 280 | if (cmd._aliases[0]) { |
| 281 | cmdName = cmdName + '|' + cmd._aliases[0]; |
| 282 | } |
| 283 | let ancestorCmdNames = ''; |
| 284 | for ( |
| 285 | let ancestorCmd = cmd.parent; |
| 286 | ancestorCmd; |
| 287 | ancestorCmd = ancestorCmd.parent |
| 288 | ) { |
| 289 | ancestorCmdNames = ancestorCmd.name() + ' ' + ancestorCmdNames; |
| 290 | } |
| 291 | return ancestorCmdNames + cmdName + ' ' + cmd.usage(); |
| 292 | } |
| 293 | |
| 294 | /** |
| 295 | * Get the description for the command. |
no test coverage detected