-
Notifications
You must be signed in to change notification settings - Fork 847
Description
The --global flag for stack config set is intended to cause configuration changes to apply to ~/.stack/config.yaml instead of the configuration of the current project.
Because resolver like all project configuration options cannot be configured in the global ~/.stack/config.yaml, in #2675 I reimplemented the field names like system-ghc and resolver as subcommands of which only some take the --global flag.
A downside to this approach is that the --global can only be passed in after the field name, so e.g. this command is a syntax error:
~ $ stack config set --global system-ghc true
Invalid option `--global'
Usage: stack config set COMMAND [--help]
Sets a field in the project's stack.yaml to value
Alternatively, it would be possible to make the --global flag an option to the stack config or stack config set commands, which would make other positions of the flag acceptable, but force the code to handle nonsensical commands like stack config set --global resolver lts elsewhere.
A monadic option parser could allow other positions for the --global while keeping stack config set --global resolver lts a syntax error. optparse-applicative provides some functionality for monadic parsing but it's more difficult to use and more difficult to get a good CLI help text with it.