haskell / haskell/cabal

"cabal user-config update" doesn't work with nested config fields

Open
#6,823 4 comments 0 reactions 0 assignees View on GitHub
attention: pr-welcome cabal-install: cmd/user-config re: user experience type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**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`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.