-
Notifications
You must be signed in to change notification settings - Fork 849
Comments
Add config get and dump commands.#5835
Add config get and dump commands. #5835philderbeast wants to merge 13 commits intocommercialhaskell:master from
Conversation
mpilgrem
commented
Aug 24, 2022
@philderbeast, given your request to not merge yet, I changed the status of the pull request to 'draft'.
philderbeast
commented
Sep 5, 2022
I've now got the order preserved in the YAML and also display the JSON in a human-readable layout also with field order preserved:
> cabal run stack -- config dump-project
# GHC 9.2.4
resolver: nightly-2022年08月02日
packages:
- .
extra-deps:
# nightly-2022年08月02日 provides hi-file-parser-0.1.2.0, which does not accomodate
# GHC 9.4.1
- hackage: hi-file-parser-0.1.3.0@sha256:b868e1bcb73fffe5963de6879f0a0a4c5ced97e08fc09c2c9428af884cdcaa74,2488
drop-packages:
# See https://github.com/commercialhaskell/stack/pull/4712
- cabal-install
flags:
stack:
developer-mode: true
user-message: |
# --nix on the command-line to enable.
If building Stack on macOS, you are advised to use stack-macos.yaml as the
project-level configuration file, and command:
stack --stack-yaml stack-macos.yaml build
See that configuration file for further information.
> cabal run stack -- config dump-project --json
{
"resolver": "nightly-2022年08月02日",
"packages": [
"."
],
"extra-deps": [
{
"hackage": "hi-file-parser-0.1.3.0@sha256:b868e1bcb73fffe5963de6879f0a0a4c5ced97e08fc09c2c9428af884cdcaa74,2488"
}
],
"drop-packages": [
"cabal-install"
],
"flags": {
"stack": {
"developer-mode": true
}
},
"user-message": "If building Stack on macOS, you are advised to use stack-macos.yaml as the\nproject-level configuration file, and command:\n\nstack --stack-yaml stack-macos.yaml build\n\nSee that configuration file for further information.\n"
}
Get the project resolver. Add config get commands. Get project system-ghc and install-ghc. Extract duplicated as logBool. Show scope. Don't log the key asked for. Should have been NoReexec. Get and Modify variants of scopeFlag help. Dump the project's configuration. Pipe to common functions for config list. Add scope and distinguish what is being dumped. Extract encodeDump* functions. First pass at dump-project and dump-stack. Separate project and stack dumps more. Add DumpStackScope and --lens option. Parse what is needed for the dump. Fix typos and improve help string. Allow for missing stack settings in the project. Fix a typo, aronud. Better explain effective scope. Drop the --global option when dumping the project.
0830fbc to
92d3141
Compare
mpilgrem
commented
Sep 9, 2022
@philderbeast, I see the CI is passing. If this is no longer 'draft', the 'Ready for review' button will turn off draft status.
mpilgrem
commented
Sep 10, 2022
I've been thinking about your proposed new commands.
We have the existing stack config set <option> dealing with the 'setting' of Stack's YAML configuration (where supported).
You propose to introduce stack config get <option> dealing with the 'getting' of information about Stack's YAML configuration (where supported).
It seemed to me that the proposed stack config dump-* was also within the domain of 'getting' information about Stack's configuration. What about the following scheme?
stack config get <option> # Gets the value of the identified Stack option (where supported)
stack config get all-project # The equivalent of your `stack config dump-project`. Gets all currently applicable project-specific configuration options
stack config get all-global # The equivalent of your `stack config dump-stack`. Gets all currently applicable non-project-specific configuration options.
On terminology, Stack's online documentation distinguishes between 'project-specific' options and 'non-project specific' options (the latter in either a 'project-level' YAML configuration file or a 'global' YAML configuration file). I think it is fine to call non-project specific options 'global options', for short.
@mpilgrem when I chose dump-* names, I was not sure whether I liked the names and thought of them as place holders. Something to come back to. Thanks for the suggestions. In testing I found some issues not related to this fix that I'd like to get to before merging around inserting extra blank lines on edit. Could be related to multiline strings with blank lines, see #5861.
mpilgrem
commented
Aug 15, 2023
@philderbeast, similar to my posts elsewhere, letting you know that I will release a new version of Stack soon, if you want to bring this pull request to a conclusion.
Uh oh!
There was an error while loading. Please reload this page.
See #5600.
Please don't merge yet as I would like to preserve the order of the fields when dumping the project as YAML.