Skip to content

Commit

Permalink
Add stack path --programs-path option
Browse files Browse the repository at this point in the history
  • Loading branch information
sjakobi committed Apr 11, 2016
1 parent f905dc3 commit 43ede53
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 3 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ Behavior changes:
* `stack init` now ignores symlinks when searching for cabal files. It also now
ignores any directory that begins with `.` (as well as `dist` dirs) - before
it would only ignore `.git`, `.stack-work`, and `dist`.
* `stack path --ghc-paths` is replaced with `--compiler-path` which points
directly at the binary used in the current project.
* The `stack path --ghc-paths` option is renamed to `--programs-path`.
`--compiler-path` is added, which points directly at the compiler used in
the current project.

Other enhancements:

Expand Down
14 changes: 9 additions & 5 deletions doc/GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,7 @@ global-stack-root: /home/michael/.stack
project-root: /home/michael/wai
config-location: /home/michael/wai/stack.yaml
bin-path: /home/michael/.stack/snapshots/x86_64-linux/lts-2.17/7.8.4/bin:/home/michael/.stack/programs/x86_64-linux/ghc-7.8.4/bin:/home/michael/.stack/programs/x86_64-linux/ghc-7.10.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
programs-path: /home/michael/.stack/programs/x86_64-linux
compiler-path: /home/michael/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc
local-bin-path: /home/michael/.local/bin
extra-include-dirs:
Expand All @@ -1487,21 +1488,24 @@ dist-dir: .stack-work/dist/x86_64-linux/Cabal-1.18.1.5
```
In addition, `stack path` accepts command line arguments to state which of
these keys you're interested in, which can be convenient for scripting. As an
example, let's just get the path to the version of GHC we're using.
these keys you're interested in, which can be convenient for scripting. As a
simple example, let's find out which versions of GHC are installed locally:
```
michael@d30748af6d3d:~/wai$ stack path --compiler-path
/home/michael/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc
michael@d30748af6d3d:~/wai$ ls $(stack path --programs-path)/*.installed
/home/michael/.stack/programs/x86_64-linux/ghc-7.10.2.installed
/home/michael/.stack/programs/x86_64-linux/ghc-7.8.4.installed
```
(Yes, that command requires a \*nix shell, and likely won't run on Windows.)
While we're talking about paths, to wipe our stack install completely, here's
what needs to be removed:
1. The stack executable itself
2. The stack root, e.g. `$HOME/.stack` on non-Windows systems.
* See `stack path --global-stack-root`
* On Windows, you will also need to delete `stack path --ghc-paths`
* On Windows, you will also need to delete `stack path --programs-paths`
3. Any local `.stack-work` directories inside a project
## exec
Expand Down
3 changes: 3 additions & 0 deletions src/main/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,9 @@ paths =
, ( "PATH environment variable"
, "bin-path"
, T.pack . intercalate [searchPathSeparator] . eoPath . piEnvOverride )
, ( "Install location for GHC and other core tools"
, "programs-path"
, T.pack . toFilePathNoTrailingSep . configLocalPrograms . bcConfig . piBuildConfig )
, ( "Compiler (e.g. ghc)"
, "compiler-path"
, T.pack . toFilePath . piCompilerPath )
Expand Down

0 comments on commit 43ede53

Please sign in to comment.