Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggesting sub-commands #26

Closed
l3nz opened this issue Jul 2, 2018 · 6 comments
Closed

Suggesting sub-commands #26

l3nz opened this issue Jul 2, 2018 · 6 comments

Comments

@l3nz
Copy link
Owner

l3nz commented Jul 2, 2018

It would be nice to detect mis-spellings and suggest alternatives.
Something similar happens in clj-sub-command.

See https://crossclj.info/fun/clj-sub-command.core/candidates.html

For example what git does is:

$ git dd amm/
git: 'dd' is not a git command. See 'git --help'.

The most similar command is
	add
@jwhitlark
Copy link
Contributor

jwhitlark commented Oct 23, 2018

I've got a branch that does:

[jason@penguin toycalc]$ clj -m toycalc add -a 40 -b 2
42
[jason@penguin toycalc]$ clj -m toycalc aad -a 40 -b 2
** ERROR: **
You called aad, did you mean to call add?
[jason@penguin toycalc]$ clj -m toycalc zoo -a 40 -b 2
** ERROR: **
Unknown sub-command
....

I'm going to tidy it up a bit, before I open a PR. In the future it could probably be modified to give the option of running the updated command with the given args....

@l3nz
Copy link
Owner Author

l3nz commented Oct 25, 2018

Looks yummy! maybe I'quote the subcommand, like:

You called subcommand 'aad', did you mean to call 'add'?

So they stand out a bit more.

@l3nz
Copy link
Owner Author

l3nz commented Oct 25, 2018

This is what git would do:

$ git commit-m "...."
git: 'commit-m' is not a git command. See 'git --help'.

The most similar command is
	commit-tree

@l3nz
Copy link
Owner Author

l3nz commented Nov 15, 2018

I saw PR #49 - not sure if I'm merging or doing it manually, but thanks. I think it rocks! 🥇

@jwhitlark
Copy link
Contributor

jwhitlark commented Nov 15, 2018 via email

@l3nz
Copy link
Owner Author

l3nz commented Nov 16, 2018

This is fixed in 0.2.5 - try it! 😃

@l3nz l3nz closed this as completed Nov 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants