From d6566e26b2ff8146102bb96489fac16d683950d3 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 12 May 2022 09:34:52 +0900 Subject: [PATCH] Support short flag of --features --- CHANGELOG.md | 2 ++ README.md | 2 +- src/cli.rs | 6 +++--- tests/long-help.txt | 2 +- tests/short-help.txt | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7683910b..88c4ed84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com ## [Unreleased] +- Support short flag of `--features` (`-F`). ([#150](https://github.com/taiki-e/cargo-hack/pull/150)) + ## [0.5.12] - 2022-01-21 - Distribute prebuilt binaries for aarch64 Linux (gnu and musl). diff --git a/README.md b/README.md index e53bd946..08b40ace 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ OPTIONS: --manifest-path Path to Cargo.toml. - --features ... + -F, --features ... Space-separated list of features to activate. --each-feature diff --git a/src/cli.rs b/src/cli.rs index a16cca20..6330c689 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -90,7 +90,7 @@ impl Args { const SUBCMD: &str = "hack"; // rustc/cargo args must be valid Unicode - // https://github.com/rust-lang/rust/blob/3bc9dd0dd293ab82945e35888ed6d7ab802761ef/compiler/rustc_driver/src/lib.rs#L1365-L1375 + // https://github.com/rust-lang/rust/blob/1.60.0/compiler/rustc_driver/src/lib.rs#L1319-L1329 fn handle_args( args: impl IntoIterator>, ) -> impl Iterator> { @@ -223,7 +223,7 @@ impl Args { Long("exclude") => exclude.push(parser.value()?.parse()?), Long("group-features") => group_features.push(parser.value()?.parse()?), - Long("features") => parse_multi_opt!(features), + Short('F') | Long("features") => parse_multi_opt!(features), Long("skip") | Long("exclude-features") => parse_multi_opt!(exclude_features), Long("include-features") => parse_multi_opt!(include_features), @@ -606,7 +606,7 @@ const HELP: &[HelpText<'_>] = &[ "This flag can only be used together with --workspace", ]), ("", "--manifest-path", "", "Path to Cargo.toml", &[]), - ("", "--features", "...", "Space-separated list of features to activate", &[]), + ("-F", "--features", "...", "Space-separated list of features to activate", &[]), ("", "--each-feature", "", "Perform for each feature of the package", &[ "This also includes runs with just --no-default-features flag, and default features.", "When this flag is not used together with --exclude-features (--skip) and \ diff --git a/tests/long-help.txt b/tests/long-help.txt index aa7527a3..285e13d5 100644 --- a/tests/long-help.txt +++ b/tests/long-help.txt @@ -24,7 +24,7 @@ OPTIONS: --manifest-path Path to Cargo.toml. - --features ... + -F, --features ... Space-separated list of features to activate. --each-feature diff --git a/tests/short-help.txt b/tests/short-help.txt index 85ab02a8..e94ab8ad 100644 --- a/tests/short-help.txt +++ b/tests/short-help.txt @@ -12,7 +12,7 @@ OPTIONS: --workspace Perform command for all packages in the workspace --exclude ... Exclude packages from the check --manifest-path Path to Cargo.toml - --features ... Space-separated list of features to activate + -F, --features ... Space-separated list of features to activate --each-feature Perform for each feature of the package --feature-powerset Perform for the feature powerset of the package --optional-deps [DEPS]... Use optional dependencies as features