New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use default flags only for new-* path #4657
Conversation
@alexbiehl, thanks for your PR! By analyzing the history of the files in this pull request, we identified @23Skidoo, @ezyang and @dcoutts to be potential reviewers. |
Ah yeah, that's because command line flags are mappended on top of the ones loaded from the config, so when they're non-mempty from the beginning, they always override whatever was in the config. I think we should just revert 1e90ae4. |
cabal-install/main/Main.hs
Outdated
] | ||
|
||
type Action = GlobalFlags -> IO () | ||
|
||
defaultsCmdWrapper :: ((ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags) -> [String] -> GlobalFlags -> IO ()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be more happy if instead of doing this we applied the defaults directly inside Cmd*.*Action
. That'd be a tad more verbose, but also more explicit.
So e.g. for CmdBuild.buildAction
you'd have:
buildAction cliFlags@(_configFlags, _configExFlags, _installFlags, _haddockFlags) ... =
let (configFlags, configExFlags, installFlags, haddockFlags) = applyFlagDefaults cliFlags
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@23Skidoo we could use ViewPatterns, then it would look like
buildAction (applyFlagDefaults -> (configFlags, configExFlags, installFlags, haddockFlags))
EDIT: syntax typo
568f519
to
71131cf
Compare
@23Skidoo it's all green! :-) |
Fixes #4581.
With 1e90ae4 flags from the global
configuration would be ignored. This patch makes sure the defaults are
mixed in only for the new-build code path.
Please include the following checklist in your PR:
Please also shortly describe how you tested your change. Bonus points for added tests!