Closed abdulhannanali closed 7 years ago
Thanks a lot! This is a great first step. I think redirecting to --help
is a good idea; of course adding suggestions would be really nice, but I don’t know what the complexity if that would be. Maybe there is a simple library to handle that.
one could easily calculate the levenstheindistance and suggest the one command with the least.
Cool, I did find a couple of Levenshtein distance calculator functions:
I assume one can run whatever command the user sent and compute the distance to all the possible commands, and if one goes below a threshold (say, 3) output that one as a suggestion; otherwise, show the --help
Makes sense?
I think that the PR is great as it is, given this fixes the more urgent problem.
Regarding @xaviervia's suggestion, could we have it as a separated PR?
Wdyt?
Thanks again @abdulhannanali.
I agree with you @pirelenito , I think this is good as it is. Refinements can come as separate releases. Go for it if you want.
@abdulhannanali please update your branch from v9
, I did a fix that should make your build green (#363)
@pirelenito Sounds good, I will do it as a separate PR. Thanks a lot @Kadrei for suggestions. I am going to use leven in order to calculate the distance.
Thanks @xaviervia for a great outlook on this problem. I will update with progress on a separate PR
@pirelenito Did that, hope the build passes.
Summary
Right now, as @pirelenito mentioned in #360 we need a handler for unknown actions, which cause the sagui to exit with non zero code, alerting the developers about the problems if any in their setup or sagui. This adds a very minimalistic solution in sagui.
However, I do have a few suggestions, we can use to improve this even further. I hope @pirelenito can look into it too after vacation.
Did you mean
messages, in order to tell the user, about the nearest matching option if any--help
If the current solution is good enough, it's okay too. :+1: I am using exit code 1 in this case.