Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upNew API for subcommands #24
Conversation
White-Oak
added some commits
Mar 22, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
|
Thanks, this looks pretty good. I'll merge it. |
added a commit
that referenced
this pull request
Mar 22, 2016
ebkalderon
merged commit faa800b
into
amethyst:master
Mar 22, 2016
1 check passed
continuous-integration/travis-ci/pr
The Travis CI build passed
Details
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
White-Oak commentedMar 22, 2016
As a need for subcommands to be run with vecs appeared(#23), I designed a pair of new traits:
AmethystArgsis a common trait for Clap-like arguments.It has two methods (
value_of,is_present) and two implementations (forclap::ArgMatchesandVec<&str>). It is a common denominator to be used in Amethyst CLI and allows to abstractize from the details of implementation.AmethystCmdis a trait that should be implemented in order to call something a subcommand.It has one method (
fn execute<I: AmethystArgs>(matches: &I) -> cargo::CmdResult) which is an entry point to every subcommand. Thus, all subcommands are called viasubcmnd_name::Cmd::execute(args).This design, with little changes to existing code, allows to call
executes both with vecs and clap-args.PS: All subcommands are update to be used with
AmethystCmd