-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SubCommands): adds support for subcommand aliases
Allows adding a subcommand alias, which function as "hidden" subcommands that automatically dispatch as if this subcommand was used. This is more efficient, and easier than creating multiple hidden subcommands as one only needs to check for the existing of this command, and not all vairants. Example: ``` let m = App::new("myprog") .subcommand(SubCommand::with_name("test") .alias("do-stuff")) .get_matches_from(vec!["myprog", "do-stuff"]); assert_eq!(m.subcommand_name(), Some("test")); ``` Example using multiple aliases: ``` let m = App::new("myprog") .subcommand(SubCommand::with_name("test") .aliases(&["do-stuff", "do-tests", "tests"])) .get_matches_from(vec!["myprog", "do-tests"]); assert_eq!(m.subcommand_name(), Some("test")); ``` Closes #469
- Loading branch information
Showing
3 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters