nabijaczleweli / cargo-update

A cargo subcommand for checking and applying updates to installed executables
MIT License
1.22k stars 42 forks source link

Preserving manually selected features across updates #180

Closed tranzystorekk closed 2 years ago

tranzystorekk commented 2 years ago

Does cargo-update know about any features that were selected during install, or does it do updates with only the defaults?

Case in point: cargo-expand has the prettyplease feature that has to be enabled by hand, and I'm wondering if it's lost on each update?

nabijaczleweli commented 2 years ago

It doesn't, because, fundamentally, that is not saved anywhere in the Cargo metadata. You can run cargo install-update-config -f prettyplease cargo-expand which will also enable the feature on subsequent updates (i.e. by installing via cargo install --features=prettyplease cargo-expand).

tranzystorekk commented 2 years ago

Thank you for the info!

dotdash commented 2 years ago

This information is present in the .crates2.json file, any chance that could be used?

  "sqlx-cli 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)": {
    "version_req": "0.6.0",
    "bins": [
      "cargo-sqlx",
      "sqlx"
    ],
    "features": [
      "postgres",
      "rustls"
    ],
    "all_features": false,
    "no_default_features": true,
    "profile": "release",
    "target": "x86_64-unknown-linux-gnu",
    "rustc": "rustc 1.64.0 (a55dd71d5 2022-09-19)\nbinary: rustc\ncommit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52\ncommit-date: 2022-09-19\nhost: x86_64-unknown-linux-gnu\nrelease: 1.64.0\nLLVM version: 14.0.6\n"
  },