commercialhaskell / commercialhaskell/stack
Add "stack config get"
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
It would be nice to add a `get` command in addition to the `set` command, e.g. for quickly getting the resolver out of a stack.yaml file. Optionally, it would also be nice to add a `--json` flag + a `list` command, so that you can reoutput the `stack.yaml` file (or any of its keys) as a JSON object.
The primary motivation is that there's no easy way to parse YAML files using builtin tools. Python has built-in JSON support, but to get YAML support, you need to install a separate library. JSON is also a bit more standard, and tools like `jq` (which isn't builtin, but some developers might have this installed globally already) can operate on JSON.
Usage:
```bash
$ stack config get resolver
lts-18.5
$ stack config get extra-deps --json
["foo-1.2.3", {"github": "bar/repo1", commit: "123"}]
$ stack config list --json | jq '.resolver'
"lts-18.5"
```
Contributor guide
Assessment
This issue has not been assessed yet.