"cabal user-config update" doesn't work with nested config fields
Describe the bug
Generate a standard cabal config file with cabal user-config init, then modify a field within another field (e.g. ar-location within program-locations). Calling cabal user-config diff would result in:
+ ar-location: /bin/my-custom-ar
But trying to apply the patch above with cabal user-config update -a "ar-location: /bin/my-custom-ar" would result in the following error:
cabal: Error parsing additional config lines: Unrecognized field ar-location
on line 1
The same error applies to all updates to nested config fields. It seems cabal user-config update only works when the diff provided by -a is only a top-level field.
To Reproduce See above.
System information
- Operating system: Ubuntu 20.04 LTS
cabal-3.2.0.0
I figured it out; one needs to pass -a program-locations\n ar-location: /bin/my-custom-ar to apply the diff. So the bug should be cabal user-config diff outputing a clearer diff which works for nested fields instead. Feel free to close this one.
One could argue that program-locations\n ar-location: /bin/my-custom-ar is not really a good syntax. So let us keep this open until we figure out how to better.
cabal user-config update does not work with program-default-options at all:
$ cabal user-config update -a '
program-default-options
ghc-pkg-options: --foo
'
This leaves the ~/.cabal/config unchanged.
It might be related to https://github.com/haskell/cabal/issues/6823.
Oh, the quotes are nice syntax. Reproduced. PRs welcome.