Skip to content

Commit

Permalink
Fix #6484 stack path avoids EnvConfig where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem committed Mar 5, 2024
1 parent 441df6f commit 93a7bd8
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 90 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Major changes:

Behavior changes:

* `stack path --global-config`, `--programs`, and `--local-bin` no longer set
up Stack's environment.

Other enhancements:

Bug fixes:
Expand Down
6 changes: 3 additions & 3 deletions doc/path_command.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# The `stack path` command

~~~text
stack path [--stack-root] [--global-config] [--project-root] [--config-location]
[--bin-path] [--programs] [--compiler-exe] [--compiler-bin]
[--compiler-tools-bin] [--local-bin] [--extra-include-dirs]
stack path [--stack-root] [--global-config] [--programs] [--local-bin]
[--project-root] [--config-location] [--bin-path] [--compiler-exe]
[--compiler-bin] [--compiler-tools-bin] [--extra-include-dirs]
[--extra-library-dirs] [--snapshot-pkg-db] [--local-pkg-db]
[--global-pkg-db] [--ghc-package-path] [--snapshot-install-root]
[--local-install-root] [--snapshot-doc-root] [--local-doc-root]
Expand Down
11 changes: 9 additions & 2 deletions src/Stack/Options/PathParser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,22 @@ module Stack.Options.PathParser

import qualified Data.Text as T
import Options.Applicative ( Parser, flag, help, long )
import Stack.Path ( paths )
import Stack.Path
( pathsFromConfig, pathsFromEnvConfig, pathsFromRunner )
import Stack.Prelude

-- | Parse command line arguments for Stack's @path@ command.
pathParser :: Parser [Text]
pathParser = mapMaybeA
( \(desc, name, _) -> flag Nothing (Just name)
( \(desc, name) -> flag Nothing (Just name)
( long (T.unpack name)
<> help desc
)
)
paths
where
toDescName (desc, name, _) = (desc, name)
paths =
pathsFromRunner
: map toDescName pathsFromConfig
<> map toDescName pathsFromEnvConfig
Loading

0 comments on commit 93a7bd8

Please sign in to comment.