Default help command does not support commands that are not entirely lower case
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 278
- PR merge metrics
- No merged PRs in 30d
Description
I am using your library in a custom project which does not adhere to usual UNIX standards when naming the commands. It uses commands akin to PowerShell commandlets as in `Write-Output`. I wanted to rename `help` to `Get-Help` with a custom hook (either using `mock` or manually overriding `Module.prototype.load`) which had some since `Get-Help Write-Output` would not print the expected help for the particular `Write-Output` command.
After reverting my rename it turns out with your default `help Write-Output` the output is still `Invalid command`. After looking through the code for far too long it turns out that this line the culprit:
https://github.com/dthree/vorpal/blob/2073ad9d77b02a05b86f122ef473a10f164e43ba/lib/vorpal-commons.js#L27
Your default `help` command is calling `toLowerCase` on the argument and then looking for a `write-output` command. However debugging yields that the name of the command is not altered when creating it and still being `Write-Output`.
In order to fix this it is only necessary to remove the linked call `toLowerCase`. Unfortunately there are still two occurences of it:
https://github.com/dthree/vorpal/blob/2073ad9d77b02a05b86f122ef473a10f164e43ba/lib/vorpal.js#L892
https://github.com/dthree/vorpal/blob/2073ad9d77b02a05b86f122ef473a10f164e43ba/lib/vorpal.js#L1091
I haven't figured out what they are exactly doing and whether my first change will break something. Once I know more and was able to test the change I am considering to open a pull request to fix this.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.