cargo-update icon indicating copy to clipboard operation
cargo-update copied to clipboard

Mimic `rustup override` behavior

Open pickfire opened this issue 5 years ago • 2 comments

Provide friendly experience for people using rustup override.

  • set to modify
  • unset to remove from config
  • list to list existing config

Personal expected behavior.

  • if the item set-ed is the default, remove the config rather than showing Default features true
  • some deprecated crate like clippy should be removed from config, alternative to rustup override unset --nonexistant would be useful
  • list all overrides (took me some time to figure out the configuration in ~/.cargo/.install_config.toml by reading the source code)

If this feature is useful though it might introduce breaking change, I can propose solution for it.

pickfire avatar Sep 27 '18 16:09 pickfire

Either I'm having a stroke or I'm deeply not getting this. Can you provide some background as to how anything is related here, because I'm actually losing my mind? (You probably have some good points (there's six, at least one is bound to be good, but I actually have no idea what I'm reading.)

nabijaczleweli avatar Sep 28 '18 20:09 nabijaczleweli

@nabijaczleweli Nice, thanks for the comment, I will try my best to make it simpler. Let me start with rustup override. Here, we can:

  • rustup override list which list all the overrides (also marks nonexistent directory where the overriden directory is not there anymore)
  • rustup override set <toolchain> to set the toolchain for the current directory
  • rustup override unset to reset to the default toolchain (can also specify the path to unset with --path)
  • rustup override unset --nonexistent to reset the default behavior for all nonexistent behavior

(Nice, just noticed that rustup override set does not have path, I probably send a patch for them to make it consistent)

Currently, cargo install-update-config can only do the set part above, it would be nice to have.

  • cargo install-update-config list to show a list of items that are overridden and if possible their values as well
  • cargo install-update-config set same as above, just to avoid confusion with the following
  • cargo install-update-config unset to reset the behavior for the crate (remove the entire block from config)
  • cargo install-update-config unset -x to reset the behavior for just a part of the crate (in this case only -x)

Another possible implementation but without the cargo install-update-config unset -x feature which would be easier to implement as of the current case but the behavior will be slightly different from rustup override. Drawback: too many flags and might be confusing when flags combined.

  • cargo install-update-config -l to list items similar to above
  • cargo install-update-config -? I don't know what is most likely to put here to reset (remove the entire block from config)
  • in this case, the other commands can be kept

As well, it would be nice to specify the config files in the man pages that is used by cargo install-update-config just in case would like to edit it manually.

pickfire avatar Sep 29 '18 03:09 pickfire