tool-sync icon indicating copy to clipboard operation
tool-sync copied to clipboard

[RFC] Update the config with the new tool in the 'install' command

Open chshersh opened this issue 3 years ago • 2 comments

The install command just installs the tool. It would be nice if it also updates the config, so the future tool sync calls would sync the tool.

The behaviour should be following:

  • [ ] Check if the tool is already in config
  • [ ] If not, add it to the end of the configuration file
  • [ ] Write an information message saying that the configuration file was updated

Alternative

Possible two behaviours:

  • This is done under the flag --update-config for the install command and the default is to not update the config
  • This is done by default and can be disabled with the --no-update-config flag

I'm not sure which default is better here 🤔 Maybe the one that doesn't change the config? Or maybe people actually want this behaviour out-of-the-box?

The feature is inspired by this comment:

  • https://www.reddit.com/r/rust/comments/x1d3of/comment/img2osl/?utm_source=reddit&utm_medium=web2x&context=3

chshersh avatar Sep 15 '22 17:09 chshersh

We could also add a prompt for the user along side one of these options if no flag is provided? That way there is no default that can mess up the config.

MitchellBerend avatar Sep 16 '22 09:09 MitchellBerend

I'm leaning towards the --update-config option for two reasons:

  1. According to CLI Guidelines, tools shouldn't mutate user-facing files unless specified explicitly.
  2. One possible use case for the tool install xyz is to install a tool, play with it locally and decide whether you actually want it or not. So you may not want to add it to the config by default but decide later.

chshersh avatar Sep 16 '22 11:09 chshersh