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

Fixes #29413 - Add fuzzy subcommand matching #327

Merged
merged 1 commit into from
Apr 28, 2020

Conversation

ofedoren
Copy link
Member

@ofedoren ofedoren commented Mar 26, 2020

Adds fuzzy (prefix) subcommand matching as in https://github.com/tstrachota/hammer-cli-experimental.

Allows to use 'reduced' hammer commands, for example:

  • hammer org l instead of hammer organization list
  • hammer ro s --id 1 instead of hammer role show --id 1
  • hammer li l instead of hammer lifecycle-environment list

If there is anthoer subcommand that starts with the same prefix, the help error is shown, e.g.:

> hammer host i
Error: Found more than one command.

Did you mean one of these?
	index
	info

Also adds possibility to use aliases for commands, for example:

  • hammer host show --id 1 instead of hammer host info --id 1
  • hammer host index instead of hammer host list

PR that adds aliases for info/list/delete commands: theforeman/hammer-cli-foreman#512

@ofedoren
Copy link
Member Author

@ares, you might want to take a look at this :)

@ares
Copy link
Member

ares commented Mar 26, 2020

Woot, I won't be able to properly review anytime soon, but quick read seems ok

Copy link
Contributor

@shiramax shiramax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ofedoren , I've tested it and it's working great,
can you add some documentation on how to use it in a new command?

@shiramax shiramax merged commit 693d2c5 into theforeman:master Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants