Repository navigation
Make v2- commands respect verbose config/project file setting - #7999
bacchanalia wants to merge 1 commit into
Conversation
|
I'm thinking about converting |
|
Until #5346 is resolved, I believe it worsens cli significantly... Compare: To: `cabal clean --help`Especially since 95% of these options don't have any effect. |
|
There is one more recent related ticket (can't remember or maybe I'm imagining) about splitting help into essential options and marginal options. Even if some options are fully or partially useless (with the current codebase; perhaps some may become useful at some point), there's not much harm if they are only listed with I think even listing the major options first and the minor last would be a great improvement and would make this change acceptable. |
|
The change I had in mind was to keep the option parsers instead of using |
sounds like a good solution to me! If done correctly, won't have any user facing changes |
- Consistently use `NixStyleFlags` for all v2- commands. - This will simplify future changes such as haskell#7999. - Mostly keep option parsers unchanged with the following exceptions: - Reorder options to by consistent with nixStyleOptions ConfigFlags > ProjectFlags > ExtraFlags - Add --ignore-project to clean, which currently does nothing, but will be useful for future clean improvements.
- Consistently use `NixStyleFlags` for all v2- commands. - This will simplify future changes such as haskell#7999. - Mostly keep option parsers unchanged with the following exceptions: - Reorder options to by consistent with nixStyleOptions ConfigFlags > ProjectFlags > ExtraFlags - Add --ignore-project to clean, which currently does nothing, but will be useful for future clean improvements.
|
This PR seems to change something. If I have an invalid field in % cabal build all --dry
Warning: /code/shared-haskell/servant/cabal.project: Unrecognized field 'foo'
on line 1
|
|
Reading project file twice is bad. That doesn't make any sense. It's easy but wrong solution. Please raise a bar for quality. |
|
iirc there is a proposal to pre-read the project file in a limited and faster way to make it possible to specify builddir in the file. That approach could be reused for this if it turns out reading the file only one time is not doable |
|
@fgaz even when reinterpreting the file multiple times, it's worth parsing it (to e.g. |
|
I agree that rereading the project file is bad. I opened this draft PR because I'm curious that people think the best way forward from here is. As I see it the options are:
|
|
I imagine in most cases, doing it for each command individually is not so bad. I suggest that The general logic is that anything that calls this is reading the global config, and when it does so, it should explicitly start potentially using the verbosity from that global config if there is not an explicit command line override. It seems like a straightforward place to extend and likely following the types will highlight all the necessary places to be changed? |
|
Currently just as many commands don't use |
WIP for #5956
I'm not completely satisfied with this approach because it effectively makes every command read all config files twice. One during the call to
newCmdWithVerbosityto set the verbosity properly, then again by the actual commands. It might be possible to pass theProjectConfigto the actions along with the command line options and disable the second read, but it doesn't seem straightforwards.An alternative would be to pick up the verbosity in each command after the individual command reads the config, but
The generic implementation doesn't work for clean or sdist because they don't use NixStyleFlags, so they need their own versions of
newCmdWithVerbosity, which I still need to implement.