Skip to content
This repository has been archived by the owner on Jun 21, 2019. It is now read-only.

Update README to append stdout to .cargo/config rather than overwrite #142

Closed
LeonardMH opened this issue Nov 3, 2018 · 3 comments
Closed

Comments

@LeonardMH
Copy link

The README suggests doing:

cargo vendor > .cargo/config

To automatically set up your cargo config file, but if you already have a cargo config file this will overwrite it. The more user friendly suggestion would be to append to cargo config with:

cargo vendor >> .cargo/config

In the event that .cargo/config does not exist, this works exactly the same as >, but if it does exist, it will ensure it isn't overwritten.

@mcepl
Copy link

mcepl commented Nov 16, 2018

Well, but will be the resulting multiple times appended .cargo/config syntactically correct?

@LeonardMH
Copy link
Author

@mcepl, I believe the answer is yes. Assuming the .cargo/config file was already syntactically valid then appending more syntactically valid TOML should not break anything.

I would also argue that > is no less risky than >> since potentially losing other changes in your .cargo/config would be a more painful experience than the alternative. This would be more inline with the wording output from cargo-vendor itself:

$ cargo vendor
add this to your .cargo/config for this project:

    ...

"add" implies concatenation.

The only bad(1) scenario I can think of would be the case where you run cargo vendor >> .cargo/config multiple times, but why would you do that?

(1): And in this case I don't think it would actually be all that bad, you'd have a messy .cargo/config but the last added dictionary would likely take precedence (at least according to my wild speculation).

@alexcrichton
Copy link
Owner

This crate is now included natively in Cargo as of rust-lang/cargo#6869 and today's nightly Rust. I'm closing all issues in this repository before I archive the repository, but if you're still interested in seeing this issue fixed then please feel free to file an issue with Cargo itself!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants