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

Add plain message format for locate-project #8707

Merged
merged 1 commit into from
Sep 23, 2020

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Sep 16, 2020

Supersedes #8683, as recommended in #8683 (comment). This PR adds a flag --message-format to cargo locate-project with possible values json (default) and plain.

$ cargo locate-project --message-format json
{"root":"/git/cargo/Cargo.toml"}

$ cargo locate-project --message-format plain
/git/cargo/Cargo.toml

Closes #8009.

@rust-highfive
Copy link

r? @alexcrichton

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 16, 2020
@dtolnay
Copy link
Member Author

dtolnay commented Sep 16, 2020

r? @ehuss

@rust-highfive rust-highfive assigned ehuss and unassigned alexcrichton Sep 16, 2020
@ehuss
Copy link
Contributor

ehuss commented Sep 16, 2020

Thanks!

@rfcbot fcp merge

@rust-lang/cargo This adds a new, stable command-line option to the cargo locate-project command to change the output format. --message-format=plain will print the project path without needing to parse JSON, which makes it much easier to use from a script (or really any tool). I think this is minor enough that I don't think it needs to go through the unstable process, but feel free to disagree.

I think --message-format is a good choice to maintain consistency with other commands. It is unfortunately inconsistent that the default is json, whereas other commands use different defaults. I think that's fine, and the docs are pretty straightforward. The only other concern is if the locate-project command is extended to print more information in the future, that will require adding additional command-line flags to control what is printed. I'm not too concerned about that, as I don't think there is much desire for additional information, and adding command-line flags is easy.

@ehuss ehuss added the T-cargo Team: Cargo label Sep 16, 2020
@ehuss
Copy link
Contributor

ehuss commented Sep 16, 2020

@rfcbot fcp merge

@rfcbot
Copy link
Collaborator

rfcbot commented Sep 16, 2020

Team member @ehuss has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period An FCP proposal has started, but not yet signed off. disposition-merge FCP with intent to merge final-comment-period FCP — a period for last comments before action is taken and removed proposed-final-comment-period An FCP proposal has started, but not yet signed off. labels Sep 16, 2020
@rfcbot
Copy link
Collaborator

rfcbot commented Sep 16, 2020

🔔 This is now entering its final comment period, as per the review above. 🔔

@ehuss
Copy link
Contributor

ehuss commented Sep 23, 2020

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Sep 23, 2020

📌 Commit 9ecf5e9 has been approved by ehuss

@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 Sep 23, 2020
@bors
Copy link
Contributor

bors commented Sep 23, 2020

⌛ Testing commit 9ecf5e9 with merge a9d6947...

@bors
Copy link
Contributor

bors commented Sep 23, 2020

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing a9d6947 to master...

@bors bors merged commit a9d6947 into rust-lang:master Sep 23, 2020
@dtolnay dtolnay deleted the plain branch September 23, 2020 22:34
RalfJung added a commit to RalfJung/rust that referenced this pull request Sep 25, 2020
Update cargo

7 commits in 8777a6b1e8834899f51b7e09cc9b8d85b2417110..05c611ae3c4255b7a2bcf4fcfa65b20286a07839
2020-09-15 19:11:03 +0000 to 2020-09-23 23:10:38 +0000
- --workspace flag for locate-project to find the workspace root (rust-lang/cargo#8712)
- Remove some badges documentation. (rust-lang/cargo#8727)
- Add plain message format for locate-project (rust-lang/cargo#8707)
- Add a term option to configure the progress bar (rust-lang/cargo#8165)
- Replace d_as_f64 with as_secs_f64 (rust-lang/cargo#8721)
- Add cross check to filters_target test. (rust-lang/cargo#8713)
- Add test for whitespace behavior in env flags. (rust-lang/cargo#8706)
@rfcbot rfcbot added finished-final-comment-period FCP complete and removed final-comment-period FCP — a period for last comments before action is taken labels Sep 26, 2020
@ehuss ehuss added this to the 1.48.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge FCP with intent to merge finished-final-comment-period FCP complete S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-cargo Team: Cargo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command-line-friendly version of locate-project
6 participants