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 ‘cargo fmt -p PACKAGE1 -p PACKAGE2’ in a workspace with several packages #1244

Closed
andersk opened this issue Dec 21, 2016 · 6 comments
Labels
good first issue Issues up for grabs, also good candidates for new rustfmt contributors p-high

Comments

@andersk
Copy link

andersk commented Dec 21, 2016

cargo fmt should support -p/--package, like most other cargo subcommands, so that one can run cargo fmt -p PACKAGE1 -p PACKAGE2 in a Cargo workspace with several packages.

@imp
Copy link

imp commented Feb 26, 2017

And may be cargo fmt --all to act on all the workspace members defined in the Cargo.toml

@Emilgardis
Copy link
Contributor

This feature would be very useful to have as rustfmt is a must-have cargo plugin and not having support for workspaces is a major inconvenience.

@nrc nrc added good first issue Issues up for grabs, also good candidates for new rustfmt contributors p-high labels Mar 27, 2017
@nrc
Copy link
Member

nrc commented Mar 27, 2017

I suspect this would be relatively easy to implement. The cargo fmt stuff is fairly self-contained (in https://github.com/rust-lang-nursery/rustfmt/blob/master/src/bin/cargo-fmt.rs) and IIUC, workspace support just comes down to specifying a different 'start file' for rustfmt.

If anyone wants to tackle this, I'd more than happy by answering questions or pointing towards parts of the system.

@Emilgardis
Copy link
Contributor

I am willing to implement this.

Emilgardis added a commit to Emilgardis/rustfmt that referenced this issue Mar 27, 2017
Emilgardis added a commit to Emilgardis/rustfmt that referenced this issue Mar 27, 2017
Emilgardis added a commit to Emilgardis/rustfmt that referenced this issue Mar 30, 2017
@nrc nrc closed this as completed in 6971b4b Mar 30, 2017
@Emilgardis
Copy link
Contributor

This has been fixed now 🎉

@pravic
Copy link

pravic commented Mar 10, 2018

so that one can run cargo fmt -p PACKAGE1 -p PACKAGE2 in a Cargo workspace with several packages.

It is strange: $ cargo fmt -p package results

Invalid argument: package.
usage: cargo fmt [options]

Several combinations revealed the only accepting form: cargo fmt -ppackage o_O

P.S. version 0.3.8-nightly (346238f 2018-02-04)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues up for grabs, also good candidates for new rustfmt contributors p-high
Projects
None yet
Development

No branches or pull requests

5 participants