Skip to content

Add "stack config get" #5600

Open
Open
@brandon-leapyear

Description

@brandon-leapyear

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:

$ 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"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions