airline
airline copied to clipboard
Automatically suggest possible commands when the command is not recognised
Currently if you use an unrecognised command name this simply results in an error. It would be nice if we did something similar to git where we try to suggest what commands the user actually meant to use e.g.
git brac
git: 'brac' is not a git command. See 'git --help'.
Did you mean this?
branch
To do this we would need to modify the CLI parser so that when it cannot find a command and there is no suitable default command we try and suggest commands. By computing string similarity between the user inputs and the actual command names we could rank possible commands and show the most appropriate suggestions.
The existing Suggester
classes possibly do this but they haven’t been touched since 0.x so would need testing and validating
Providing a specific error handler that falls over to the suggested when a command/option is not understood might also be useful