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 --update-only flag to cargo-add #117

Merged
merged 2 commits into from
Jun 18, 2017

Conversation

bjgill
Copy link
Collaborator

@bjgill bjgill commented Jun 18, 2017

This adds the specified dependency/ies only if they are already present. Thus, it acts like a 'cargo upgrade' (see #74).

This PR is a partial solution to the problem of updating dependencies in Cargo.toml for crates in a workspace that do not share the same set of dependencies. Once this has been merged, one will then be able to upgrade the dependency foo for all crates by running cargo multi add --update-only foo (using cargo-multi).

This adds the specified dependency/ies only if they are already present. Thus, it acts like a 'cargo upgrade' (see killercup#74)
@killercup
Copy link
Owner

Very nice PR!

Can you add a small integration test (or two) to assert that doing this on the CLI also works? Just append it to tests/cargo-add.rs :)

I'm not sure I really like the semantics of calling cargo add without adding something, but on the other hand I don't think cargo update will want to change the Cargo.toml. So, let's go for it.

@bjgill
Copy link
Collaborator Author

bjgill commented Jun 18, 2017

I've added a couple of tests for the mainline function.

Yes - I'm just going for something quick that reduces pain for a relatively common use-case. I suspect the next step would be to solve #74 properly by creating a new subcommand that took the output from cargo list and fed it into cargo add.

@killercup
Copy link
Owner

killercup commented Jun 18, 2017

FYI, my current plans for this repo are:

  • get a nice toml writer lib (open issue since 2015…)
  • refactor cargo-{add,rm} to use state of the art deps -- or at least the same cargo uses
  • make this useful as a library

Especially the last point would allow you to write a cargo upgrade relatively easily.

But for now:

@homu r+ okay, that service seems to finally be offline, i'll merge manually

@killercup killercup merged commit 2eae582 into killercup:master Jun 18, 2017
@bjgill bjgill deleted the cargo-add-update-only branch June 18, 2017 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants