Skip to content

Commit

Permalink
Replace argparse with structopt
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
robinkrahl authored and d-e-s-o committed Jan 7, 2020
1 parent b9fbc48 commit c1f35ab
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 639 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Unreleased
----------
- Reworked argument handling:
- Added `structopt` dependency in version `0.3.7`
- Replaced `argparse` with `structopt`
- Removed vendored dependencies and moved source code into repository
root

Expand Down
3 changes: 1 addition & 2 deletions src/arg_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@ macro_rules! Command {
fn execute(
self,
ctx: &mut crate::args::ExecCtx<'_>,
args: ::std::vec::Vec<::std::string::String>,
) -> crate::Result<()> {
match self {
$(
$name::$var(_) => $exec(ctx, args),
$name::$var(args) => $exec(ctx, args),
)*
}
}
Expand Down
Loading

0 comments on commit c1f35ab

Please sign in to comment.