-
Notifications
You must be signed in to change notification settings - Fork 696
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
Add global configuration option for non-interactive cabal init. #5825
Conversation
@@ -873,6 +914,15 @@ configFieldDescriptions src = | |||
configAllowNewer (\v flags -> flags { configAllowNewer = v }) | |||
] | |||
|
|||
++ toSavedConfig liftInitFlag | |||
(initOptions ParseArgs) | |||
["quiet", "no-comments", "minimal", "overwrite", "package-dir", |
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'm wondering if toSavedConfig
would be better if this was an explicit list of what to include in the global config instead of an exclude list. In this case non-interactive
is the only thing (at this point) from InitFlags
that we want to be able to configure in ~/.cabal/config
. Using an exclude list also introduces the possibility of newly added flags sneaking into the global config. Just a thought.
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.
Makes sense. We could also do something like IncludeAll | IncludeWhiteList [FlagName]
.
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.
Added to my TODO list :)
Not sure if this needs to be in the changelog since it may be renamed before the 3.0 release. I'll update the changelog when we finalize on naming/behaviour/etc. |
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.
LGTM.
@@ -873,6 +914,15 @@ configFieldDescriptions src = | |||
configAllowNewer (\v flags -> flags { configAllowNewer = v }) | |||
] | |||
|
|||
++ toSavedConfig liftInitFlag | |||
(initOptions ParseArgs) | |||
["quiet", "no-comments", "minimal", "overwrite", "package-dir", |
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.
Makes sense. We could also do something like IncludeAll | IncludeWhiteList [FlagName]
.
Merged, thanks! |
I'd change the name to something more intuitive like
gives me no clue about what it does. |
I'd like to refactor/rename it to
In general I find negative flags confusing, both in CLI usage as well as when reading/modifying the code. Now that this is I'll revisit the issue in the issue I linked above. |
Sounds good! |
Overview
This PR adds support for specifying the
non-interactive
option forcabal init
in~/.cabal/config
with the default value beingFalse
. This does not change any default behaviour.When the configuration file is generated (when it does not exist), it will contain the following line:
This partially addresses #5696.
Testing
Manually tested. Added
non-interactive: False
to~/.cabal/config
and rancabal init
:Note that no
.hs
files (other than Setup) are generated because the default isLibrary
which currently doesn't generate any Haskell files for (at least until #5740 is merged). Also, I'd like to change this to generate an executable by default (see follow-ups section below).Possible follow-ups (RFC)
non-interactive: False
) to a positive (interactive-init: True
)cabal init
to by default generate anExecutable
orLibAndExe
(the more common case, see the "Default to executable" section of Beginner friendly cabal-install CLI #5696 for rationale).cabal init
requires no args and generates an executable)Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!