Skip to content

Commit 97ba984

Browse files
committed
Re #5305 Improve existing stack script --extra-dep documentation
1 parent 1cfe5e3 commit 97ba984

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

doc/commands/script_command.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,18 @@ For example:
5252
stack script --snapshot lts-23.14 MyScript.hs
5353
~~~
5454

55-
A package version can be added to the snapshot on the command line with the
56-
`--extra-dep` option (which can be specified multiple times).
55+
An extra-dep from the package index can be added to the snapshot on the command
56+
line with the `--extra-dep` option (which can be specified multiple times).
57+
58+
Such an extra-dep can be specified using a valid YAML string value. For further
59+
information, see the [package location](../topics/package_location.md)
60+
documentation. Examples are:
61+
62+
~~~text
63+
--extra-dep acme-missiles-0.3
64+
--extra-dep acme-missiles-0.3@rev:0
65+
--extra-dep acme-missiles-0.3@sha256:2ba66a092a32593880a87fb00f3213762d7bca65a687d45965778deb8694c5d1,613
66+
~~~
5767

5868
GHC boot packages that have been 'replaced' (see further below) can be specified
5969
as an `--extra-dep`.

doc/topics/package_location.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ example (where the file size is `631` bytes):
6262

6363
~~~yaml
6464
extra-deps:
65-
- acme-missiles-0.3@sha256:2ba66a092a32593880a87fb00f3213762d7bca65a687d45965778deb8694c5d1,631
65+
- acme-missiles-0.3@sha256:2ba66a092a32593880a87fb00f3213762d7bca65a687d45965778deb8694c5d1,613
6666
~~~
6767

6868
Optionally, you can specify also the Pantry tree information. For example:

doc/topics/scripts.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ stack script --snapshot lts-23.14 -- MyScript.hs arg1 arg2 +RTS -s -RTS
139139
where `+RTS -s -RTS` are some of GHC's
140140
[runtime system (RTS) options](https://downloads.haskell.org/~ghc/latest/docs/users_guide/runtime_control.html).
141141

142+
Arguments that include spaces can be quoted using double quotation marks.
143+
142144
## Just-in-time compilation
143145

144146
As with using [`stack script`](../commands/script_command.md) at the command
@@ -169,6 +171,20 @@ options, or by providing a comma or space separated list. For example:
169171
-}
170172
~~~
171173

174+
## Using extra-deps
175+
176+
As with using [`stack script`](../commands/script_command.md) at the command
177+
line, you can also specify one or more extra-deps from the package index using a
178+
valid YAML string for each. For example:
179+
180+
~~~haskell
181+
#!/usr/bin/env stack
182+
{- stack script
183+
--snapshot lts-23.14
184+
--extra-dep acme-missile-0.3@rev:0
185+
-}
186+
~~~
187+
172188
## Stack configuration for scripts
173189

174190
When using the [`stack script`](../commands/script_command.md) command, as when

0 commit comments

Comments
 (0)