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

Synonyms for submodules #21

Closed
glennmatthews opened this issue Dec 19, 2014 · 3 comments
Closed

Synonyms for submodules #21

glennmatthews opened this issue Dec 19, 2014 · 3 comments

Comments

@glennmatthews
Copy link
Owner

Would be nice to provide various synonyms for the built-in submodules to make the CLI more intuitive/discoverable. Some possibilities:

cot info --> cot describe
cot edit-hardware --> cot hw, cot hw-edit
cot inject-config --> cot set-bootstrap

Etc.

@glennmatthews
Copy link
Owner Author

This could probably be done by calling add_parser() multiple times for each submodule - however the args for each subparser would need to be added each time as well unless we want to use a shared "parent parser" - however, see http://stackoverflow.com/questions/7498595/python-argparse-add-argument-to-multiple-subparsers.

@glennmatthews
Copy link
Owner Author

Easier than that - add_parser() takes an aliases parameter:

checkout = subparsers.add_parser('checkout', aliases=['co'])

@glennmatthews
Copy link
Owner Author

...but only in 3.2 or later, not 2.7: http://bugs.python.org/issue13879

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

No branches or pull requests

1 participant