Skip to content

Commit

Permalink
Migrate to my clap fork
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Saveau <[email protected]>
  • Loading branch information
SUPERCILEX committed Jan 13, 2023
1 parent 01015a4 commit ffb5a23
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 81 deletions.
82 changes: 41 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ license = "Apache-2.0"
[dependencies]
bytesize = "1.1.0"
cfg-if = "1.0.0"
clap = { version = "4.0.32", features = ["derive", "wrap_help"] }
clap-num = "1.0.2"
clap-verbosity-flag = "2.0.0"
clap2 = { version = "4.0.32", features = ["derive", "wrap_help"] }
clap2-num = "1.0.2"
clap2-verbosity-flag = "2.0.0"
error-stack = "0.2.4"
# TODO use the real itoa once https://github.com/dtolnay/itoa/pull/34 goes through
itoa-const = "1.0.5"
Expand Down Expand Up @@ -43,7 +43,7 @@ more-asserts = "0.3.1"
rand = { version = "0.8.5", default-features = false, features = ["std", "std_rng"] }
rstest = "0.16.0"
seahash = "4.1.0"
supercilex-tests = "0.2.1"
supercilex-tests = "0.2.2"
tempfile = "3.3.0"
trycmd = "0.14.10"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Options:
[default: 0]

-h, --help
Print help information (use `-h` for a summary)
Print help (use `-h` for a summary)

-q, --quiet...
Less output per occurrence
Expand Down
6 changes: 3 additions & 3 deletions command-reference-short.golden
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Commands:
help Print this message or the help of the given subcommand(s)

Options:
-h, --help Print help information (use `--help` for more detail)
-h, --help Print help (use `--help` for more detail)
-q, --quiet... Less output per occurrence
-v, --verbose... More output per occurrence
-V, --version Print version information
-V, --version Print version

---

Expand All @@ -34,7 +34,7 @@ Options:
-r, --ftd-ratio <FILE_TO_DIR_RATIO> The number of files to generate per directory (default: files
/ 1000)
--seed <SEED> Change the PRNG's starting seed [default: 0]
-h, --help Print help information (use `--help` for more detail)
-h, --help Print help (use `--help` for more detail)
-q, --quiet... Less output per occurrence
-v, --verbose... More output per occurrence

Expand Down
6 changes: 3 additions & 3 deletions command-reference.golden
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Commands:

Options:
-h, --help
Print help information (use `-h` for a summary)
Print help (use `-h` for a summary)

-q, --quiet...
Less output per occurrence
Expand All @@ -19,7 +19,7 @@ Options:
More output per occurrence

-V, --version
Print version information
Print version

---

Expand Down Expand Up @@ -92,7 +92,7 @@ Options:
[default: 0]

-h, --help
Print help information (use `-h` for a summary)
Print help (use `-h` for a summary)

-q, --quiet...
Less output per occurrence
Expand Down
11 changes: 7 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ use std::{
};

use clap::{builder::ArgPredicate, ArgAction, Args, Parser, Subcommand, ValueHint};
use clap2 as clap;
use clap2_num as clap_num;
use clap2_verbosity_flag as clap_verbosity_flag;
use clap_num::si_number;
use clap_verbosity_flag::Verbosity;
use error_stack::{IntoReport, ResultExt};
Expand All @@ -20,7 +23,6 @@ use paste::paste;
#[derive(Parser, Debug)]
#[command(version, author = "Alex Saveau (@SUPERCILEX)")]
#[command(infer_subcommands = true, infer_long_args = true)]
#[command(max_term_width = 100)]
#[command(disable_help_flag = true)]
#[cfg_attr(test, command(help_expected = true))]
struct Ftzz {
Expand All @@ -32,8 +34,8 @@ struct Ftzz {
verbose: Verbosity,

#[arg(short, long, short_alias = '?', global = true)]
#[arg(action = ArgAction::Help, help = "Print help information (use `--help` for more detail)")]
#[arg(long_help = "Print help information (use `-h` for a summary)")]
#[arg(action = ArgAction::Help, help = "Print help (use `--help` for more detail)")]
#[arg(long_help = "Print help (use `-h` for a summary)")]
help: Option<bool>,
}

Expand All @@ -57,6 +59,7 @@ enum Cmd {
}

#[derive(Args, Debug)]
#[command(arg_required_else_help = true)]
struct Generate {
/// The directory in which to generate files
///
Expand Down Expand Up @@ -368,6 +371,6 @@ mod cli_tests {

#[test]
fn help_for_review() {
supercilex_tests::help_for_review(Ftzz::command());
supercilex_tests::help_for_review2(Ftzz::command());
}
}
Loading

0 comments on commit ffb5a23

Please sign in to comment.