commercialhaskell / commercialhaskell/stack

Cannot set work-dir config variable using CLI

Open
#5,640 0 comments 0 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### General summary/comments

I would like to be able to use `stack config set` to manipulate `stack.yaml` without having to parse the config myself. However, the command only seems to work for some options (e.g. `resolver`) but not others (e.g. `work-dir`)

May be related to #5573

### Steps to reproduce

```
stack new project
cd project
stack config set work-dir custom_dir_name
```

### Expected

The file `./stack.yaml` should be modified to contain `work-dir: ./custom_dir_name/` or equivalent. Subsequent stack commands for this project should use the directory `./custom_dir_name/` instead of `./.stack-work/`, creating it if it does not exist.

### Actual

```
$ stack config set work-dir custom_dir_name --verbose
Invalid argument `work-dir'
Auxiliary command not found in path `stack-config'
File does not exist or is not a regular file `config'

Usage: stack config set COMMAND [--setup-info-yaml URL]
[--snapshot-location-base URL] [--help]
Sets a field in the project's stack.yaml to value
```

### Stack version

```
$ stack --version
Version 2.7.3, Git revision 7927a3aec32e2b2e5e4fb5be76d0d50eddcc197f x86_64 hpack-0.34.4
```

### Method of installation

```
$ curl -sSL https://get.haskellstack.org/ | sh
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `stack config set work-dir custom_dir_name` in a new project and inspect the handling of `stack config set` fields. Compare the supported `resolver` behavior with `work-dir`; done means `./stack.yaml` contains the requested work directory and subsequent Stack commands use or create it instead of `./.stack-work/`.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.