Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support short flag of --features #150

Merged
merged 1 commit into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ OPTIONS:
--manifest-path <PATH>
Path to Cargo.toml.

--features <FEATURES>...
-F, --features <FEATURES>...
Space-separated list of features to activate.

--each-feature
Expand Down
6 changes: 3 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Item = impl Into<OsString>>,
) -> impl Iterator<Item = Result<String>> {
Expand Down Expand Up @@ -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),

Expand Down Expand Up @@ -606,7 +606,7 @@ const HELP: &[HelpText<'_>] = &[
"This flag can only be used together with --workspace",
]),
("", "--manifest-path", "<PATH>", "Path to Cargo.toml", &[]),
("", "--features", "<FEATURES>...", "Space-separated list of features to activate", &[]),
("-F", "--features", "<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 \
Expand Down
2 changes: 1 addition & 1 deletion tests/long-help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ OPTIONS:
--manifest-path <PATH>
Path to Cargo.toml.

--features <FEATURES>...
-F, --features <FEATURES>...
Space-separated list of features to activate.

--each-feature
Expand Down
2 changes: 1 addition & 1 deletion tests/short-help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ OPTIONS:
--workspace Perform command for all packages in the workspace
--exclude <SPEC>... Exclude packages from the check
--manifest-path <PATH> Path to Cargo.toml
--features <FEATURES>... Space-separated list of features to activate
-F, --features <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
Expand Down