Skip to content

Commit

Permalink
Merge pull request #6486 from commercialhaskell/fix6484
Browse files Browse the repository at this point in the history
Fix #6484 stack path avoids EnvConfig where possible
  • Loading branch information
mpilgrem authored Feb 15, 2024
2 parents 8f27d6f + c811c33 commit 160c00a
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 90 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Behavior changes:
* Stack uses the version of the Cabal package that comes with the specified
version of GHC. Stack no longer supports such Cabal versions before 2.2, which
came with versions of GHC before 8.4.
* `stack path --global-config`, `--programs`, and `--local-bin` no longer set
up Stack's environment.

Other enhancements:

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 160c00a

Please sign in to comment.