commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
3.95k stars 842 forks source link

Add `stack config set recommend-stack-upgrade` #6546

Closed m4lvin closed 3 months ago

m4lvin commented 3 months ago

I was expecting

stack config set recommend-stack-upgrade false

to work, similar to stack config set system-ghc --global true etc.

This would provide a more programmatic way to disable the warning shown when running an old version of stack:

Warning: You are currently using Stack version 2.13.1 but version 2.15.3 is available.

         You can try to upgrade by running stack upgrade

         Tired of seeing this? Add recommend-stack-upgrade: false to
         /home/codegrade/.stack/config.yaml.

(Motivation/background: I am running stack in containers for autograding student code. They should not see with this warning (and in other steps I use --silent, but here I want to show compile errors). For now I have a script to write to config.yml manually, but that seems a bit fragile.)

mpilgrem commented 3 months ago

@m4lvin, thanks for the suggestion. I'll try to implement it.

mpilgrem commented 3 months ago

This is implemented in Stack's master branch. If you are not using GHCup to manage versions of Stack: stack upgrade --source-only --git.

m4lvin commented 3 months ago

Wow, super quick!

Looking at the code and because I just now saw the notification about nix being in my PATH the first time, maybe a generic way to set notifyIfNixOnPath, notifyIfGhcUntested and so on with stack config would make sense?

mpilgrem commented 3 months ago

@m4lvin, I am happy to add those too. My general approach to extending stack config set is a conservative one: to do it only on the basis of an identified genuine user need.

m4lvin commented 3 months ago

Okay, I do not actually have a specific need for that one.