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

Add aliases to commands #6

merged 1 commit into from May 28, 2017


None yet
3 participants
Copy link

randycoulman commented May 28, 2017

Allow a command to have one or more aliases to make the CLI more convenient to use.

Per the discussion in #5, this PR implements aliases for commands as opposed to some kind of fuzzy matching strategy..

Aliases are defined as follows:

command :hello do
  aliases [:hi]
  # ...

Implementation notes:

  • Parser now delegates the matching of a command name to a command to Command; Command.match/2 compares the provided name to the command's name and its aliases.

  • I've tested this against one of my projects and it works great!

  • I chose not to add the aliases to the usage output, as I felt that it would mess up the output too much. Instead, the aliases can be shown in the detailed command help once that feature is implemented.

  • I chose not to address the issue of potential collisions between an alias and another command (or an alias and another command's alias). There is no collision detection done for command names currently, so I maintained that pattern.

Closes #5.

Add aliases to commands
Allow a command to have one or more aliases to make the CLI more convenient to use.

This comment has been minimized.

Copy link

coveralls commented May 28, 2017

Coverage Status

Coverage increased (+0.01%) to 97.449% when pulling e5952a4 on randycoulman:add-command-aliases into 846ee3e on tuvistavie:master.


This comment has been minimized.

Copy link

danhper commented May 28, 2017

Looks great, thank you very much!

@danhper danhper merged commit 16ee6c4 into danhper:master May 28, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
coverage/coveralls Coverage increased (+0.01%) to 97.449%

@randycoulman randycoulman deleted the randycoulman:add-command-aliases branch May 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment