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

Consider using cargo add in the new command #204

Closed
tomasol opened this issue Jan 10, 2024 · 1 comment · Fixed by #209
Closed

Consider using cargo add in the new command #204

tomasol opened this issue Jan 10, 2024 · 1 comment · Fixed by #209

Comments

@tomasol
Copy link
Contributor

tomasol commented Jan 10, 2024

Currently cargo component new generates the dependency with the version fixed in the binary, e.g. cargo-component-bindings = "0.6.0" .
I would prefer having the same behavior as when calling cargo add cargo-component-bindings, generating cargo-component-bindings.workspace = true if I am inside a workspace and have version set in [workspace.dependencies]. If the version is not set, cargo add checks the latest version which is I believe preferable.

@peterhuene
Copy link
Member

@tomasol Thanks for the suggestion!

I think spawning cargo to do what you suggest is a good idea so that we don't have to duplicate the logic for detecting workspace membership.

The new subcommand of cargo-component predates cargo add and needs to modify the manifest anyway, so that's primarily why it's done that way now.

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 a pull request may close this issue.

2 participants