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

chore(doc): doc for custom subcommands look up. #13203

Merged
merged 1 commit into from
Dec 27, 2023

Conversation

linyihai
Copy link
Contributor

What does this PR try to resolve?

as the #13194 metions, the lookup rules for custom subcommands are only reflected in comments inside the code, and it is time to inform users of this behavior through documentation.

How should we test and review this PR?

Additional information

@rustbot
Copy link
Collaborator

rustbot commented Dec 25, 2023

r? @weihanglo

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

@rustbot rustbot added A-documenting-cargo-itself Area: Cargo's documentation S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 25, 2023
@@ -265,6 +265,12 @@ cargo `(?<command>[^ ]+)` into an invocation of an external tool
`cargo-${command}`. The external tool must be present in one of the user's
`$PATH` directories.

> Note: Cargo looks for custom subcommands in `$PATH `and then `$CARGO_HOME/bin`,
Copy link
Member

Choose a reason for hiding this comment

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

This seems a bit incorrect. I may emphasize two things:

  • By default, tools in $CARGO_HOME/bin take precedence over tools in $PATH.
  • Users can put $CARGO_HOME/bin in $PATH to control the precedence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By default, tools in $CARGO_HOME/bin take precedence over tools in $PATH.

Yes, Indeed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've polished the description to the best of my ability, hoping to get it right.

Comment on lines 268 to 270
> Note: By default, Cargo invokes custom subcommand in `$CARGO_HOME/bin`
> instead of `$PATH`. If you want to change this behavior, you can put
> `$CARGO_HOME/bin` in `$PATH` to control the precedence.
Copy link
Member

Choose a reason for hiding this comment

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

"instead of" doesn't convey the precedence. How about this?

Suggested change
> Note: By default, Cargo invokes custom subcommand in `$CARGO_HOME/bin`
> instead of `$PATH`. If you want to change this behavior, you can put
> `$CARGO_HOME/bin` in `$PATH` to control the precedence.
> **Note**: Cargo defaults to prioritizing external tools in `$CARGO_HOME/bin`
> over `$PATH`. Users can override this precedence by adding `$CARGO_HOME/bin`
> to `$PATH`.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've used what you suggested and it looks pretty good without any grammar problems

@weihanglo
Copy link
Member

Thank you :)

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 27, 2023

📌 Commit d71b2bc has been approved by weihanglo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 27, 2023
@bors
Copy link
Collaborator

bors commented Dec 27, 2023

⌛ Testing commit d71b2bc with merge 1f70597...

@bors
Copy link
Collaborator

bors commented Dec 27, 2023

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing 1f70597 to master...

@bors bors merged commit 1f70597 into rust-lang:master Dec 27, 2023
20 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 1, 2024
Update cargo

7 commits in ac6bbb33293d8d424c17ecdb42af3aac25fb7295..ef94adb92704acf3967be8cf73ac0b01d818c47a
2023-12-26 23:22:08 +0000 to 2023-12-31 02:20:45 +0000
- cleanup: Remove error-format special-case in `cargo fix` (rust-lang/cargo#13224)
- `cargo fix`: always inherit the jobserver (rust-lang/cargo#13225)
- Bump cargo-credential to 0.4.3 (rust-lang/cargo#13221)
- `cargo add` - fix for adding features from repository with multiple packages. (rust-lang/cargo#13213)
- Remove repetitive words (rust-lang/cargo#13216)
- Add cargo:rustc-cdylib-link-arg into RESERVED_PREFIXES list (rust-lang/cargo#13212)
- chore(doc): doc for custom subcommands look up. (rust-lang/cargo#13203)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 3, 2024
Update cargo

11 commits in ac6bbb33293d8d424c17ecdb42af3aac25fb7295..add15366eaf3f3eb84717d3b8b71902ca36a7c84
2023-12-26 23:22:08 +0000 to 2024-01-02 03:24:42 +0000
- chore(deps): update gix (rust-lang/cargo#13230)
- chore(deps): update alpine docker tag to v3.19 (rust-lang/cargo#13228)
- rustfix: Support inserting new lines. (rust-lang/cargo#13226)
- Fix fix::fix_in_dependency to not rely on rustc (rust-lang/cargo#13220)
- cleanup: Remove error-format special-case in `cargo fix` (rust-lang/cargo#13224)
- `cargo fix`: always inherit the jobserver (rust-lang/cargo#13225)
- Bump cargo-credential to 0.4.3 (rust-lang/cargo#13221)
- `cargo add` - fix for adding features from repository with multiple packages. (rust-lang/cargo#13213)
- Remove repetitive words (rust-lang/cargo#13216)
- Add cargo:rustc-cdylib-link-arg into RESERVED_PREFIXES list (rust-lang/cargo#13212)
- chore(doc): doc for custom subcommands look up. (rust-lang/cargo#13203)
@ehuss ehuss added this to the 1.77.0 milestone Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

document external cargo subcommand PATH precedence
5 participants