Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config get and dump commands. #5835

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
78 changes: 58 additions & 20 deletions doc/GUIDE_advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,36 +78,52 @@ the command, see the [build command](build_command.md) documentation.

## The `stack config` commands

The `stack config` commands provide assistence with accessing or modifying
The `stack config` commands provide assistance with accessing or modifying
Stack's configuration. See `stack config` for the available commands.

## The `stack config env` command
## The `stack config dump-*` commands

`stack config env` outputs a script that sets or unsets environment variables
for a Stack environment. Flags modify the script that is output:
These commands dump YAML but can dump JSON with an added `--json` flag.

* `--[no-]locals` (enabled by default) include/exclude local package information
* `--[no-]ghc-package-path` (enabled by default) set `GHC_PACKAGE_PATH`
environment variable or not
* `--[no-]stack-exe` (enabled by default) set `STACK_EXE` environment variable
or not
* `--[no-]locale-utf8` (disabled by default) set the `GHC_CHARENC`
environment variable to `UTF-8` or not
* `--[no-]keep-ghc-rts` (disabled by default) keep/discard any `GHCRTS`
environment variable
## The `stack config dump-project` command

The `stack config dump-project` command dumps project-only configuration. Any
non-project configuration in the project is removed.

## The `stack config dump-stack` command

The `stack config dump-stack` command dumps configuration related to the
operation of stack itself. This is non-project configuration. With `--lens` we
can look at the configuration coming from the global settings, from stack
settings within the project or the effective combination from those two
locations.

## The `stack config get` commands

The `stack config get` commands gets values of keys in YAML configuration
files but only those that can also be set.

## The `stack config get resolver` command

Gets the effective resolver.

## The `stack config get *-ghc` commands

The `--global` option will get these settings' global value.

## The `stack config get system-ghc` commands

Gets whether stack should use the system GHC installation.

## The `stack config get install-ghc` command

Gets whether stack should install GHC by itself.

## The `stack config set` commands

The `stack config set` commands allow the values of keys in YAML configuration
files to be set. See `stack config set` for the available keys.

## The `stack config set install-ghc` command

`stack config set install-ghc true` or `false` sets the `install-ghc` key in a
YAML configuration file, accordingly. By default, the project-level
configuration file (`stack.yaml`) is altered. The `--global` flag specifies the
user-specific global configuration file (`config.yaml`).

## The `stack config set resolver` command

`stack config set resolver <snapshot>` sets the `resolver` key in the
Expand All @@ -128,6 +144,28 @@ YAML configuration file, accordingly. By default, the project-level
configuration file (`stack.yaml`) is altered. The `--global` flag specifies the
user-specific global configuration file (`config.yaml`).

## The `stack config set install-ghc` command

`stack config set install-ghc true` or `false` sets the `install-ghc` key in a
YAML configuration file, accordingly. By default, the project-level
configuration file (`stack.yaml`) is altered. The `--global` flag specifies the
user-specific global configuration file (`config.yaml`).

## The `stack config env` command

`stack config env` outputs a script that sets or unsets environment variables
for a Stack environment. Flags modify the script that is output:

* `--[no-]locals` (enabled by default) include/exclude local package information
* `--[no-]ghc-package-path` (enabled by default) set `GHC_PACKAGE_PATH`
environment variable or not
* `--[no-]stack-exe` (enabled by default) set `STACK_EXE` environment variable
or not
* `--[no-]locale-utf8` (disabled by default) set the `GHC_CHARENC`
environment variable to `UTF-8` or not
* `--[no-]keep-ghc-rts` (disabled by default) keep/discard any `GHCRTS`
environment variable

## The `stack dot` command

If you'd like to get some insight into the dependency tree of your packages, you
Expand Down
1 change: 1 addition & 0 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies:
- base >= 4.16.3.0 && < 5
- Cabal >= 3.6.3.0
- aeson >= 2.0.3.0
- aeson-pretty
- annotated-wl-pprint
- ansi-terminal
- array
Expand Down
Loading