PaulDance / cargo-liner

Cargo subcommand to install and update binary packages listed in configuration
https://crates.io/crates/cargo-liner
GNU General Public License v3.0
11 stars 2 forks source link

ignore locally installed packages when importing #21

Closed ToBinio closed 9 months ago

ToBinio commented 9 months ago

Description packages installed via cargo install --path <path> also show up in the .crates.toml and so they get imported via cargo liner import most locally installed packages should not be updated via cargo liner since they either don't exist on a registry or they are some custom patch with would be overwritten by an update.

Preferred solution ignore all locally installed packages when importing

note: I don't think I can assign myself but I plan on trying to implement this

PaulDance commented 9 months ago

Oooh, fair point! I didn't consider this case, for sure.

Implementing the very basic fix / feature for this will very probably require additional parsing of the $CARGO_HOME/.crates.toml file done in order to save the in-parenthesis source. An enumeration should represent this well. The part before the + will probably be the variants and after an associated URL. Checking all the possible source values in some documentation or source of Cargo should still be done in order to ensure nothing was forgotten, however.

Then, from a feature point of view, at the very least the change should be reflected by adding a mention of the filtering in the command's documentation comments so end users may see it from the usage messages. Beyond that, you can either let it be something always done in a hard-coded fashion, or additionally implement a new CLI option in order to force keeping the local-only installs in the resulting table. In the second case however, the default would still be to filter them out. I usually do this when implementing such a breaking change so end users may choose for themselves while still ending up with a sensible default.