homebrew-cask-upgrade icon indicating copy to clipboard operation
homebrew-cask-upgrade copied to clipboard

Add a config for default behaviour

Open ondrejfuhrer opened this issue 5 years ago • 7 comments

As a user I would like to set a default behaviour to brew cu command. As an example I might wan't to always run it with --all option.

Desired flow:

> brew cu
==> Options
Include auto-update (-a): false
Include latest (-f): false

Config change

> brew cu config set auto-update true
Option "auto-update" has been set to "true" by default.
> brew cu
==> Options
Include auto-update (-a): true
Include latest (-f): false

Options overview:

  • brew cu config set KEY VALUE - sets a certain value to the key
  • brew cu config reset KEY - resets certain key to a default state
  • brew cu config reset - resets all keys to a default state
  • brew cu config list - prints all configs
  • brew cu --ignore-config - running brew cu command in a default state (as there are no configs set)

Available keys:

  • auto-update - if auto-update apps should be updated
  • latest - if "latest" apps should be updated
  • interactive - always run the upgrade as interactive
  • force-yes - always update all the apps (no interaction needed)

ondrejfuhrer avatar Apr 14 '20 08:04 ondrejfuhrer

what about a dotfile like .brewcu config file (in current dir and in your ~/ home dir

there i can set all options with like on command line

i would also expect only this new commands: brew cu -f ./current_config_file brew cu --ignore-config

order: 1 command line options 2 ./.brewcu 3 ~/.brewcu

muescha avatar Apr 14 '20 14:04 muescha

Hey @muescha , thank you very much for your feedback! I really appreciate that. It would anyways use a dotfile (or some sort of config file in the home dir) to store those options, so what you are suggesting is very much possible. And true that probably the implementation would be much easier and adding the manipulation through brew cu config commands can be added later on.

Regarding the order: Do you see a use case where you would like to have a different behaviour based on the execution context? Wouldn't that bee too confusing?

brew cu -f ./current_config_file

Also do you see a valid use case here, having multiple settings? PS: -f is already taken, therefore it would be more likely -c and --config

ondrejfuhrer avatar Apr 14 '20 16:04 ondrejfuhrer

i was just thinking in general about commands and their .dotfiles and where i expect it to read from which places and in which order.

Do you see a use case where you would like to have a different behaviour based on the execution context? Wouldn't that bee too confusing?

you are right we can remove that 2 ./.brewcu

brew cu -f ./current_config_file

Also do you see a valid use case here, having multiple settings?

maybe in a ci environment or something like this but you are sure i don't know where it is needed

muescha avatar Apr 14 '20 17:04 muescha

should the pinned file also go somewhere here near the .brew-cu ... maybe in as a .brew-cu-ignore file?

muescha avatar Sep 22 '20 18:09 muescha

@muescha I was also thinking about it and the "issue" I have with it is that this gets not cleaned after uninstalling. The cu command configuration is fine to be "persistent", it is basically a saved preference how you want to use it, but pinned info is more about a state. Therefore when you uninstall the tap the state should be removed as well, what do you think?

ondrejfuhrer avatar Sep 23 '20 16:09 ondrejfuhrer

but if someone save his ".dotfiles" maybe he like to remember all the pinned files also. so i expect it there and not in a "magic" hidden folder 🤔

muescha avatar Sep 23 '20 17:09 muescha

but i think thats can be done in a different PR and not for this change... sorry for highjacking this PR with the idea

muescha avatar Sep 23 '20 17:09 muescha