aboutsummaryrefslogtreecommitdiff
path: root/src/args.rs
Commit message (Collapse)AuthorAge
* Order members in args.rs by command hierarchyRobin Krahl2020-01-08
| | | | | | | | | | | | | | | Currently, the ordering in the args.rs file is inconsistent and arbitrary. This patch orders the members by command hierarchy: - common data structures - for each command C: - CArgs - CCommand - for each subcommand S: - SArgs - custom data structures - custom functions - main argument handling function
* Set possible values for all enum options and argumentsRobin Krahl2020-01-07
| | | | | | | This patch adds the possible_values method to the structopt attributes for all enum options and arguments using the all_str function added in the previous patch. Therefore, the help messages now also list the possible values for these options.
* Use closures instead of command functionsRobin Krahl2020-01-07
| | | | | To simplify the code, this patch replaces the one-line argument handling functions with closures.
* Remove str argument from Command! macroRobin Krahl2020-01-07
| | | | | | | As we no longer have to implement the Display and AsRef traits for the enums generated with the Command! macro, we don’t have to set a string representation either. So we can drop this argument from the Command! macro.
* Remove unused code after structopt transitionRobin Krahl2020-01-07
| | | | | | In the previous patches, we replaced argparse with structopt and removed the argparse dependency. This patch removes the code that was only needed for argparse.
* Replace argparse with structoptRobin Krahl2020-01-07
| | | | | | | | | | | | This patch changes the argument handling code to use structopt instead of argparse using the data structures we introduced in the last patch. As part of that transition we replace the old Error::ArgparseError variant with ClapError that stores a structopt::clap::Error. Because of that replacement, the format of the help messages changed, breaking some of the tests. Hence, this change adapts them accordingly. Also clap currently prints the version output to stdout, so we ignore the version_option test case for now.
* Add data structures for the options and argumentsRobin Krahl2020-01-07
| | | | | | This patch introduces new structs that can be used with structopt to store the options and arguments parsed from the command line. These structs use the existing enums and command structs.
* Use strings instead of Command variantsRobin Krahl2020-01-07
| | | | | | | | | In one of the next patches, we will add fields to some Command variants to be able to use them with structopt. Then we will no longer be able to instantiate them directly, so we replace these instances for the transition. This patch also removes the cmd_help! macro that is no longer needed.
* Refactor the Enum! macro into Enum! and Command!Robin Krahl2020-01-07
| | | | | | For an easier transition to structopt, this patch splits the two cases of the Enum! macro into two separate macros (that internally both call the new enum_int! macro).
* Move nitrocli source code into repository rootDaniel Mueller2020-04-04
Now that all vendored dependencies have been removed, this change moves the program's source code from the nitrocli/ directory into the root of the repository.