From 25a7a2ac7570a1c3bdca0b4f3e97fcb831a76027 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Wed, 31 Jan 2024 23:14:51 +0000 Subject: [PATCH] Re #6466 Add `--snapshot` as synonym for `--resolver` --- ChangeLog.md | 1 + doc/global_flags.md | 29 ++++++++++++++++++----------- doc/yaml_configuration.md | 4 +++- src/Stack/Options/ResolverParser.hs | 9 +++++---- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index c05ea1f15c..9e7e8fce0a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -91,6 +91,7 @@ Other enhancements: * Add option `--filter ` to Stack's `ls dependencies text` command to filter out an item from the results, if present. The item can be `$locals` for all local packages. +* Add option `--snapshot` as synonym for `--resolver`. Bug fixes: diff --git a/doc/global_flags.md b/doc/global_flags.md index cd3fdaad78..b5e66677ab 100644 --- a/doc/global_flags.md +++ b/doc/global_flags.md @@ -172,17 +172,8 @@ it, it is best omitted from the debug output. ## `--resolver` option -Pass the option `--resolver ` to specify the snapshot. For further -information, see the -[YAML configuration](yaml_configuration.md#snapshot) documentation. - -At the command line (only): - -* `--resolver lts-` specifies the latest Stackage LTS Haskell - snapshot with the specified major version; -* `--resolver lts` specifies, from those with the greatest major version, the - latest Stackage LTS Haskell snapshot; and -* `--resolver nightly` specifies the most recent Stackage Nightly snapshot. +A synonym for the [`--snapshot` option](#snapshot-option) to specify the +snapshot resolver. ## `--[no-]rsl-in-log` flag @@ -223,6 +214,22 @@ Enables/disables the skipping of installing MSYS2. For further information, see the documentation for the corresponding non-project specific configuration [option](yaml_configuration.md#skip-msys). +## `--snapshot` option + +:octicons-tag-24: UNRELEASED + +Pass the option `--snapshot ` to specify the snapshot. For further +information, see the [YAML configuration](yaml_configuration.md#snapshot) +documentation. + +At the command line (only): + +* `--snapshot lts-` specifies the latest Stackage LTS Haskell + snapshot with the specified major version; +* `--snapshot lts` specifies, from those with the greatest major version, the + latest Stackage LTS Haskell snapshot; and +* `--snapshot nightly` specifies the most recent Stackage Nightly snapshot. + ## `--stack-colors` or `--stack-colours` options Pass the option `--stack-colors ` to specify Stack's output styles. For diff --git a/doc/yaml_configuration.md b/doc/yaml_configuration.md index d44d575a8c..d121a75e1b 100644 --- a/doc/yaml_configuration.md +++ b/doc/yaml_configuration.md @@ -95,7 +95,9 @@ snapshot. ### snapshot -Command line equivalent (takes precedence): `--resolver` option +Command line equivalent (takes precedence): +[`--snapshot`](global_flags.md#snapshot-option) or +[`--resolver`](global_flags.md#resolver-option) option The `snapshot` key specifies which snapshot is to be used for this project. A snapshot defines a GHC version, a number of packages available for installation, diff --git a/src/Stack/Options/ResolverParser.hs b/src/Stack/Options/ResolverParser.hs index 9a06b932b2..7f023ca919 100644 --- a/src/Stack/Options/ResolverParser.hs +++ b/src/Stack/Options/ResolverParser.hs @@ -15,12 +15,13 @@ import Stack.Options.Utils ( hideMods ) import Stack.Prelude import Stack.Types.Resolver ( AbstractResolver, readAbstractResolver ) --- | Parser for the resolver +-- | Parser for the snapshot abstractResolverOptsParser :: Bool -> Parser (Unresolved AbstractResolver) abstractResolverOptsParser hide = option readAbstractResolver - ( long "resolver" - <> metavar "RESOLVER" - <> help "Override resolver in project file." + ( long "snapshot" + <> long "resolver" + <> metavar "SNAPSHOT" + <> help "Override snapshot in the project configuration file." <> hideMods hide )