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

Fix incorrect help message #6555

Merged
merged 1 commit into from
Feb 14, 2019
Merged

Fix incorrect help message #6555

merged 1 commit into from
Feb 14, 2019

Conversation

Phlosioneer
Copy link
Contributor

The cargo clean --target command does not have a default setting, but the command-line help text says it does.

The `cargo clean --target` command does not have a default setting, but the command-line help text says it does.
@rust-highfive
Copy link

r? @nrc

(rust_highfive has picked a reviewer for you, use r? to override)

@ehuss
Copy link
Contributor

ehuss commented Jan 17, 2019

I think what it is trying to say is that if you don't specify --target, it cleans all of them. i.e., that's the default behavior without the flag.

@@ -7,7 +7,7 @@ pub fn cli() -> App {
.about("Remove artifacts that cargo has generated in the past")
.arg_package_spec_simple("Package to clean artifacts for")
.arg_manifest_path()
.arg_target_triple("Target triple to clean output for (default all)")
.arg_target_triple("Target triple to clean output for")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What @ehuss said ^

Perhaps:

Suggested change
.arg_target_triple("Target triple to clean output for")
.arg_target_triple("Target triple to clean output for (defaults to all targets)")

@Phlosioneer
Copy link
Contributor Author

Phlosioneer commented Jan 17, 2019

It's confusing to me because it's the only one that specifies the default behavior. It led me to believe that cargo clean --target, without a triple, would default to "all".

I found what I was looking for when I discovered that cargo clean --target all is accepted.

I still think it should be removed as the only default behavior explanation, but you can close this PR if you want.

@dwijnand
Copy link
Member

Looks like there is a .default_value:

fn arg_message_format(self) -> Self {
self._arg(
opt("message-format", "Error format")
.value_name("FMT")
.case_insensitive(true)
.possible_values(&["human", "json", "short"])
.default_value("human"),
)
}

Maybe in this PR we should move the mention of "all" from the description to a call to .default_value in arg_target_triple:

fn arg_target_triple(self, target: &'static str) -> Self {
self._arg(opt("target", target).value_name("TRIPLE"))
}

@ehuss
Copy link
Contributor

ehuss commented Jan 17, 2019

After thinking about it some more, perhaps it should be removed? cargo clean is not the most precise of commands, and is a little fuzzy in how it works. If you do cargo clean -p pkgname, then indeed it only cleans using the normal convention (no --target cleans host only). I think some of the confusion is that bare cargo clean just deletes everything, and is a bit special.

So I think I am 👍 on this now.

@ehuss
Copy link
Contributor

ehuss commented Jan 17, 2019

Hm, but there is a bit of a bug where cargo clean --target xxx ignores the --target flag. That seems like a separate issue. Although given #3530 (comment) maybe that's confusing? Hmm...

@Phlosioneer
Copy link
Contributor Author

Phlosioneer commented Jan 18, 2019

I think I like @dwijnand’s idea to clarify that the default is for when --target is omitted, not when the target triple is omitted.

Would “(normally cleans all targets)” work? It avoids the word default so that there is no confusion over whether the target triple argument has a default.

@Phlosioneer
Copy link
Contributor Author

@ehuss I might look into that separate bug when I get home. If I can figure it out, I’ll make a PR for it. Shouldn’t be too hard.

@ehuss
Copy link
Contributor

ehuss commented Jan 19, 2019

Would “(normally cleans all targets)” work? It avoids the word default so that there is no confusion over whether the target triple argument has a default.

Except it doesn't always clean all targets. The only time it does that is if you don't provide a package (i.e. a bare cargo clean). I would just remove the parenthetical. And maybe update the after-help to make it a little clearer that cargo clean without any options just deletes the entire target directory. That's maybe implied by "all packages' artifacts are removed", but that could maybe be a little clearer.

@ehuss
Copy link
Contributor

ehuss commented Feb 14, 2019

@dwijnand Do you object to merging this as-is, and then following up later with more documentation about how cargo clean works? It might also be an opportunity to survey the deficiencies of cargo clean and sketch out some fixes to make it work better.

@dwijnand
Copy link
Member

Sure, I'm always down for incremental improvements and eagerly landing changes.

@bors r+

@bors
Copy link
Contributor

bors commented Feb 14, 2019

📌 Commit 26232c3 has been approved by dwijnand

@bors
Copy link
Contributor

bors commented Feb 14, 2019

⌛ Testing commit 26232c3 with merge 6022bbb...

bors added a commit that referenced this pull request Feb 14, 2019
Fix incorrect help message

The `cargo clean --target` command does not have a default setting, but the command-line help text says it does.
@bors
Copy link
Contributor

bors commented Feb 14, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: dwijnand
Pushing 6022bbb to master...

@bors bors merged commit 26232c3 into rust-lang:master Feb 14, 2019
bors added a commit to rust-lang/rust that referenced this pull request Feb 21, 2019
Update cargo

9 commits in 865cb70106a6b1171a500ff68f93ab52eea56e72..b33ce7fc9092962b0657b4c25354984b5e5c47e4
2019-02-10 15:49:37 +0000 to 2019-02-19 18:42:50 +0000
- Don't retry invalid credentials from git credential helpers (rust-lang/cargo#6681)
- Fix some typos in resolver tests (rust-lang/cargo#6682)
- Add an unstable option to build proc macros for both the host and the target (rust-lang/cargo#6547)
- Test cases proving RUSTC_WRAPPER can be a relative path (rust-lang/cargo#6638)
- Add support for Azure DevOps (rust-lang/cargo#6264)
- Update docs for removed `patch` restriction. (rust-lang/cargo#6663)
- Fix incorrect help message (rust-lang/cargo#6555)
- Stabilize Alternative Registries (rust-lang/cargo#6654)
- Having a [patch] section when publishing is not an error (rust-lang/cargo#6535)
@ehuss ehuss added this to the 1.34.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants