-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Display alias target on 'cargo help <alias>` #10193
Conversation
Previously, `cargo help <alias>` resolved the alias and displayed the help for the targeted subcommand. For example, if `br` were aliased to `build --release`, `cargo help br` would display the manpage for cargo-build. With this patch, it will print "'br' is aliased to 'build --release'".
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. Please see the contribution instructions for more information. |
Aha, found the test location! I'll fix that up. |
One good UX option here may be to show the manpage if the alias is a simple command, e.g., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Might need to update doc of handle_embedded_help
as well? Since we don't display man for alias anymore
cargo/src/bin/cargo/commands/help.rs
Lines 18 to 20 in 6d75259
/// Returns `true` if a man page was displayed. In this case, Cargo should | |
/// exit. | |
pub fn handle_embedded_help(config: &Config) -> bool { |
Co-authored-by: Weihang Lo <[email protected]>
Co-authored-by: Weihang Lo <[email protected]>
This changes the behavior so that simple aliases that directly alias a subcommand (with no arguments) pass-through to that subcommand, while complex aliases (with arguments) show the alias. So for example, `cargo help b` will show the manpage for `cargo-build`, while `cargo help my-alias`, aliased to `build --release`, will show "`my-alias` is aliased to `build --release`".
@bors: r+ Seems reasonable to me, thanks! |
📌 Commit 4c66d18 has been approved by |
☀️ Test successful - checks-actions |
Thank you @sstangl ! |
Update cargo 14 commits in 40dc281755137ee804bc9b3b08e782773b726e44..a359ce16073401f28b84840da85b268aa3d37c88 2021-12-06 21:54:44 +0000 to 2021-12-14 18:40:22 +0000 - Support `term.quiet` configuration (rust-lang/cargo#10152) - Display alias target on 'cargo help <alias>` (rust-lang/cargo#10193) - delete --host command and message (rust-lang/cargo#10145) - Improve I/O error message for fingerprint of build script (rust-lang/cargo#10191) - Explicitly mark aliases in `cargo list`. (rust-lang/cargo#10177) - Don't emit "executable" JSON field for non-executables. (rust-lang/cargo#10171) - Move scrape-examples docs to correct section. (rust-lang/cargo#10166) - Do not suggest source config if nothing to vendor (rust-lang/cargo#10161) - Bump versions of local deps. (rust-lang/cargo#10155) - Bump to 0.60.0, update changelog (rust-lang/cargo#10154) - Fix some profile documentation. (rust-lang/cargo#10153) - Document lib before bin. (rust-lang/cargo#10172) - Sync cargo-the-cli version with rustc. (rust-lang/cargo#10178) - Remove `-Z future-incompat-report` from message displayed to user (rust-lang/cargo#10185)
Addresses issue #10138.
This is my first patch to Cargo. I attempted to follow the style of the surrounding code. Please let me know if any changes are required: happy to make them. In particular, I wasn't sure if any tests exist for this path.