diff --git a/ChangeLog.md b/ChangeLog.md index 908902b7c9..397bf47ec8 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -25,6 +25,7 @@ Other enhancements: * From GHC 9.12.1, `base` is not a GHC wired-in package. In configuration files, the `notify-if-base-not-boot` key is introduced, to allow the exisitng notification to be muted if unwanted when using such GHC versions. +* Add option `-w` as synonym for `--stack-yaml`. Bug fixes: diff --git a/doc/build_overview.md b/doc/build_overview.md index 11753ecf8b..c4c569b35d 100644 --- a/doc/build_overview.md +++ b/doc/build_overview.md @@ -52,8 +52,8 @@ Given these inputs, Stack attempts the following process when performing a build ## Find the `stack.yaml` file -* Check for a `--stack-yaml` CLI arg, and use that -* Check for a `STACK_YAML` env var +* Check for a `--stack-yaml` or `-w` command line argument, and use that +* Check for a `STACK_YAML` environment variable * Look for a `stack.yaml` in this directory or ancestor directories * Fall back to the default global project @@ -199,7 +199,7 @@ they get prepended otherwise they get used as is. Use some deterministic binary serialization and SHA256 thereof to get a hash of the following information: -* Actual compiler (GHC version, path, *FIXME* probably some other unique info +* Actual compiler (GHC version, path, *FIXME* probably some other unique info from GHC, I have heard that `ghc --info` gives you something) * Global database map * Immutable dependency map @@ -233,7 +233,7 @@ installed in this database will never need to be rebuilt. all enabled components (using the fun backwards compat logic for `build-tools`) * Apply the logic recursively to come up with a full build plan -* If a task depends exclusively on immutable packages, mark it as immutable. +* If a task depends exclusively on immutable packages, mark it as immutable. Otherwise, it is mutable. The former go into the snapshot database, the latter into the local database. diff --git a/doc/configure/environment_variables.md b/doc/configure/environment_variables.md index 806926d0f1..069fe01b4c 100644 --- a/doc/configure/environment_variables.md +++ b/doc/configure/environment_variables.md @@ -167,7 +167,7 @@ Related command: all commands that make use of Stack's [project-level configuration](yaml/index.md). Overridden by: Stack's global -[`--stack-yaml`](global_flags.md#-stack-yaml-option) option. +[`--stack-yaml`](global_flags.md#-stack-yaml-or-w-option) option. The environment variable `STACK_YAML` can be used to specify Stack's project-level configuration file. diff --git a/doc/configure/global_flags.md b/doc/configure/global_flags.md index 9dbffedc03..ca5356f1c7 100644 --- a/doc/configure/global_flags.md +++ b/doc/configure/global_flags.md @@ -324,7 +324,7 @@ Pass the option `--stack-root ` to specify the path to the [Stack root](../topics/stack_root.md) directory. The path must be an absolute one. -## `--stack-yaml` option +## `--stack-yaml` or `-w` option Default: `stack.yaml` diff --git a/doc/configure/yaml/index.md b/doc/configure/yaml/index.md index 45e96eb5a7..293bbd9492 100644 --- a/doc/configure/yaml/index.md +++ b/doc/configure/yaml/index.md @@ -73,7 +73,7 @@ Stack's configuration files are each of one of two types: Stack obtains project-level configuration from one of the following (in order of preference): -1. A file specified by the `--stack-yaml` command line option. +1. A file specified by the `--stack-yaml` or `-w` command line option. 2. A file specified by the `STACK_YAML` environment variable. 3. A file named `stack.yaml` in the current directory or an ancestor directory. 4. A file name `stack.yaml` in the `global-project` directory in the diff --git a/doc/tutorial/stack_configuration.md b/doc/tutorial/stack_configuration.md index d1a6df86fe..63c4b801fc 100644 --- a/doc/tutorial/stack_configuration.md +++ b/doc/tutorial/stack_configuration.md @@ -5,7 +5,7 @@ Whenever you run something with Stack, it needs a project-level configuration file. The algorithm Stack uses to find such a file is: -1. Check for a `--stack-yaml` option on the command line +1. Check for a `--stack-yaml` or `-w` option on the command line 2. Check for a `STACK_YAML` environment variable 3. Check the current directory and all ancestor directories for a `stack.yaml` file @@ -30,7 +30,7 @@ for you with the latest LTS snapshot. This allows you to do things like: Keep in mind that there is nothing magical about this implicit global configuration. It has no effect on projects at all. Every package you install with it is put into isolated databases just like everywhere else. The only magic -is that it is the catch-all project whenever you are running Stack somewhere +is that it is the catch-all project whenever you are running Stack somewhere else. ## Package description vs project-level configuration diff --git a/src/Stack/Options/GlobalParser.hs b/src/Stack/Options/GlobalParser.hs index 11505557f0..9cc6201e8e 100644 --- a/src/Stack/Options/GlobalParser.hs +++ b/src/Stack/Options/GlobalParser.hs @@ -17,7 +17,7 @@ module Stack.Options.GlobalParser import Options.Applicative ( Mod, Parser, ReadM, auto, completer, help, hidden, internal - , long, metavar, option, strOption, value + , long, metavar, option, short, strOption, value ) import Options.Applicative.Builder.Extra ( fileExtCompleter, firstBoolFlagsFalse @@ -102,6 +102,7 @@ globalOptsParser currentDir kind = GlobalOptsMonoid )) <*> optionalFirst (strOption ( long "stack-yaml" + <> short 'w' <> metavar "STACK-YAML" <> completer (fileExtCompleter [".yaml"]) <> help "Override project stack.yaml file (overrides any STACK_YAML \