Skip to content

Commit 4dc5ca8

Browse files
committed
Further related to commands in Markdown
1 parent ae3a5ee commit 4dc5ca8

File tree

8 files changed

+387
-230
lines changed

8 files changed

+387
-230
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,17 @@ You can install HLint with Stack. You might want to install it in the global
220220
project in case you run into dependency conflicts. HLint can report hints in
221221
your favourite text editor. Refer to the HLint repository for more details.
222222

223-
To install:
223+
To install, command:
224224

225-
stack install hlint
225+
~~~text
226+
stack install hlint
227+
~~~
226228

227-
Once installed, you can check your changes with:
229+
Once installed, you can check your changes with command:
228230

229-
$ ./etc/scripts/hlint.sh
231+
~~~text
232+
stack exec -- sh ./etc/scripts/hlint.sh
233+
~~~
230234

231235
## Testing
232236

doc/GUIDE.md

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,8 @@ stack build
515515
We can also change resolvers on the command line, which can be useful in a
516516
Continuous Integration (CI) setting, like on Travis. For example, command:
517517

518-
~~~textstack --resolver lts-18.28 build
518+
~~~text
519+
stack --resolver lts-18.28 build
519520
# Downloaded lts-18.28 build plan.
520521
# build output ...
521522
~~~
@@ -822,23 +823,27 @@ much more composable command lines. For example, we can have a command that
822823
builds executables, generates Haddock documentation (Haskell API-level docs),
823824
and builds and runs your test suites, with:
824825

825-
826-
$ stack build --haddock --test
826+
~~~text
827+
stack build --haddock --test
828+
~~~
827829

828830
You can even get more inventive as you learn about other flags. For example,
829-
take the following:
831+
take the following command:
830832

831-
$ stack build --pedantic --haddock --test --exec "echo Yay, it succeeded" --file-watch
833+
~~~text
834+
stack build --pedantic --haddock --test --exec "echo Yay, it succeeded" --file-watch
835+
~~~
832836

833-
This will:
837+
This command will:
834838

835-
* turn on all warnings and errors
839+
* turn on all warnings and errors (the `--pendantic` flag)
836840
* build your library and executables
837-
* generate Haddocks
838-
* build and run your test suite
839-
* run the command `echo Yay, it succeeded` when that completes
841+
* generate Haddocks (the `--haddock` flag)
842+
* build and run your test suite (the `--test` flag)
843+
* run the command `echo Yay, it succeeded` when that completes (the `--exec`
844+
option)
840845
* after building, watch for changes in the files used to build the project, and
841-
kick off a new build when done
846+
kick off a new build when done (the `--file-watch` flag)
842847

843848
### The `stack install` command and `copy-bins` option
844849

@@ -849,15 +854,19 @@ precisely one thing in addition to the build command: it copies any generated
849854
executables to the local binary directory. You may recognize the default value
850855
for that path:
851856

852-
On Unix-like operating systems:
857+
On Unix-like operating systems, command:
853858

854-
$ stack path --local-bin
855-
/home/<user_name>/.local/bin
859+
~~~text
860+
stack path --local-bin
861+
/home/<user_name>/.local/bin
862+
~~~
856863

857-
On Windows:
864+
On Windows, command:
858865

859-
$ stack path --local-bin
860-
C:\Users\<user_name>\AppData\Roaming\local\bin
866+
~~~text
867+
stack path --local-bin
868+
C:\Users\<user_name>\AppData\Roaming\local\bin
869+
~~~
861870

862871
That's why the download page recommends adding that directory to your PATH. This
863872
feature is convenient, because now you can simply run `executable-name` in your
@@ -877,10 +886,11 @@ Since it's such a point of confusion, let me list a number of things Stack does
877886
* Stack will not necessarily be creating a relocatable executable. If your
878887
executables hard-codes paths, copying the executable will not change those
879888
hard-coded paths.
880-
* At the time of writing, there's no way to change those kinds of paths with
881-
Stack, but see
882-
[issue #848 about --prefix](https://github.com/commercialhaskell/stack/issues/848)
883-
for future plans.
889+
890+
* At the time of writing, there's no way to change those kinds of paths with
891+
Stack, but see
892+
[issue #848 about --prefix](https://github.com/commercialhaskell/stack/issues/848)
893+
for future plans.
884894

885895
That's really all there is to the `install` command: for the simplicity of what
886896
it does, it occupies a much larger mental space than is warranted.

doc/GUIDE_advanced.md

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -269,49 +269,61 @@ resulting package archive, to test it.
269269
Stack provides multiple templates to start a new project from. You can specify
270270
one of these templates following your project name in the `stack new` command:
271271

272-
$ stack new my-rio-project rio
273-
Downloading template "rio" to create project "my-rio-project" in my-rio-project/ ...
274-
Looking for .cabal or package.yaml files to use to init the project.
275-
Using cabal packages:
276-
- my-rio-project/
277-
278-
Selecting the best among 18 snapshots...
279-
280-
* Matches ...
281-
282-
Selected resolver: ...
283-
Initialising configuration using resolver: ...
284-
Total number of user packages considered: 1
285-
Writing configuration to file: my-rio-project/stack.yaml
286-
All done.
287-
<Stack root>\templates\rio.hsfiles: 10.10 KiB downloaded...
272+
~~~text
273+
stack new my-rio-project rio
274+
Downloading template "rio" to create project "my-rio-project" in my-rio-project/ ...
275+
Looking for .cabal or package.yaml files to use to init the project.
276+
Using cabal packages:
277+
- my-rio-project/
278+
279+
Selecting the best among 18 snapshots...
280+
281+
* Matches ...
282+
283+
Selected resolver: ...
284+
Initialising configuration using resolver: ...
285+
Total number of user packages considered: 1
286+
Writing configuration to file: my-rio-project/stack.yaml
287+
All done.
288+
<Stack root>\templates\rio.hsfiles: 10.10 KiB downloaded...
289+
~~~
288290

289291
The default templates repository is
290292
https://github.com/commercialhaskell/stack-templates. You can download templates
291-
from a different Github user by prefixing the username and a slash:
293+
from a different Github user by prefixing the username and a slash. Command:
292294

293-
$ stack new my-yesod-project yesodweb/simple
295+
~~~text
296+
stack new my-yesod-project yesodweb/simple
297+
~~~
294298

295299
Then template file `simple.hsfiles` would be downloaded from GitHub repository
296300
`yesodweb/stack-templates`.
297301

298302
You can even download templates from a service other that GitHub, such as
299-
[GitLab](https://gitlab.com) or [Bitbucket](https://bitbucket.com). For example:
303+
[GitLab](https://gitlab.com) or [Bitbucket](https://bitbucket.com). For example,
304+
command:
300305

301-
$ stack new my-project gitlab:user29/foo
306+
~~~text
307+
stack new my-project gitlab:user29/foo
308+
~~~
302309

303310
Template file `foo.hsfiles` would be downloaded from GitLab, user account
304311
`user29`, repository `stack-templates`.
305312

306-
If you need more flexibility, you can specify the full URL of the template:
313+
If you need more flexibility, you can specify the full URL of the template.
314+
Command:
307315

308-
$ stack new my-project https://my-site.com/content/template9.hsfiles
316+
~~~text
317+
stack new my-project https://my-site.com/content/template9.hsfiles
318+
~~~
309319

310320
(The `.hsfiles` extension is optional; it will be added if it's not specified.)
311321

312-
Alternatively you can use a local template by specifying the path:
322+
Alternatively you can use a local template by specifying the path. Command:
313323

314-
$ stack new project <path_to_template>/template.hsfiles
324+
~~~text
325+
stack new project <path_to_template>/template.hsfiles
326+
~~~
315327

316328
As a starting point for creating your own templates, you can use the
317329
["simple" template](https://github.com/commercialhaskell/stack-templates/blob/master/simple.hsfiles).

doc/install_and_upgrade.md

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -319,44 +319,44 @@ wget -qO- https://get.haskellstack.org/ | sh
319319
<!-- * [Linux AArch64](https://get.haskellstack.org/stable/linux-aarch64.tar.gz) -->
320320

321321
* Extract the archive and place `stack` somewhere on your PATH (see the
322-
[Path](#path) section below)
322+
[Path](#path) section below).
323323

324324
* Ensure you have required system dependencies installed. These include GCC, GNU
325325
Make, xz, perl, libgmp, libffi, and zlib. We also recommend Git and GPG. To
326326
install these using your package manager:
327327

328-
* Debian / Ubuntu, command:
328+
* Debian / Ubuntu, command:
329329

330-
~~~text
331-
sudo apt-get install g++ gcc libc6-dev libffi-dev libgmp-dev make xz-utils zlib1g-dev git gnupg netbase
332-
~~~
330+
~~~text
331+
sudo apt-get install g++ gcc libc6-dev libffi-dev libgmp-dev make xz-utils zlib1g-dev git gnupg netbase
332+
~~~
333333

334-
* Fedora / CentOS, command:
334+
* Fedora / CentOS, command:
335335

336-
~~~text
337-
sudo dnf install perl make automake gcc gmp-devel libffi zlib zlib-devel xz tar git gnupg
338-
~~~
336+
~~~text
337+
sudo dnf install perl make automake gcc gmp-devel libffi zlib zlib-devel xz tar git gnupg
338+
~~~
339339

340-
(use `yum` instead of `dnf` on CentOS and Fedora <= 21)
340+
(use `yum` instead of `dnf` on CentOS and Fedora <= 21)
341341

342-
* Fedora 24: In order to use `stack setup` on a 32-bit system, you may
343-
need to run `sudo dnf install ncurses-compat-libs`. If this package is
344-
not installed, Stack may not be able to install 32-bit GHC versions.
342+
* Fedora 24: In order to use `stack setup` on a 32-bit system, you may
343+
need to run `sudo dnf install ncurses-compat-libs`. If this package is
344+
not installed, Stack may not be able to install 32-bit GHC versions.
345345

346-
* Arch Linux, command:
346+
* Arch Linux, command:
347347

348-
~~~text
349-
sudo pacman -S make gcc ncurses git gnupg xz zlib gmp libffi zlib
350-
~~~
348+
~~~text
349+
sudo pacman -S make gcc ncurses git gnupg xz zlib gmp libffi zlib
350+
~~~
351351

352-
* In order to use `stack setup` with older versions of GHC or on a
353-
32-bit system, you may need the
354-
[ncurses5-compat-libs](https://aur.archlinux.org/packages/ncurses5-compat-libs/)
355-
AUR package installed. If this package is not installed, Stack may not
356-
be able to install older (< 7.10.3) or 32-bit GHC versions.
352+
* In order to use `stack setup` with older versions of GHC or on a
353+
32-bit system, you may need the
354+
[ncurses5-compat-libs](https://aur.archlinux.org/packages/ncurses5-compat-libs/)
355+
AUR package installed. If this package is not installed, Stack may
356+
not be able to install older (< 7.10.3) or 32-bit GHC versions.
357357

358-
* Gentoo users, make sure to have the `ncurses` package with `USE=tinfo`
359-
(without it, Stack will not be able to install GHC).
358+
* Gentoo users, make sure to have the `ncurses` package with
359+
`USE=tinfo` (without it, Stack will not be able to install GHC).
360360

361361
* Now you can run Stack from the command line in a terminal.
362362

@@ -390,26 +390,32 @@ Run:
390390

391391
You can install Stack by copying the executable file anywhere on your PATH. A
392392
good place to install is the same directory where Stack itself will install
393-
executables. On Windows, that directory is `%APPDATA%\local\bin`, e.g. `c:\Users\<user-name>\AppData\Roaming\local\bin`. For other systems, it's
394-
`$HOME/.local/bin`.
393+
executables. On Unix-like operating systems, that directory is:
394+
395+
~~~text
396+
$HOME/.local/bin
397+
~~~
395398

396-
If you don't have that directory in your PATH, you may need to update your PATH
397-
(such as, on Unix-like operating systems, by editing `~/.bashrc`).
399+
On Windows, that directory is:
400+
401+
~~~text
402+
%APPDATA%\local\bin
403+
~~~
404+
405+
For example: `C:\Users\<user-name>\AppData\Roaming\local\bin`.
406+
407+
If you don't have that directory in your PATH, you may need to update your PATH.
408+
On Unix-like operating systems, that can be done by editing the `~/.bashrc`
409+
file.
398410

399411
If you're curious about the choice of these directories, see
400412
[issue #153](https://github.com/commercialhaskell/stack/issues/153)
401413

402414
## Shell auto-completion
403415

404-
To get tab-completion of commands on bash, just run the following (or add it to
405-
`.bashrc`):
406-
407-
~~~text
408-
eval "$(stack --bash-completion-script stack)"
409-
~~~
410-
411-
For more information and other shells, see the
412-
[shell auto-completion](shell_autocompletion.md) page.
416+
On Unix-like operating systems, it is possible to set up auto-completion of
417+
Stack commands. For further information, see the
418+
[shell auto-completion](shell_autocompletion.md) documentation.
413419

414420
## China-based users
415421

0 commit comments

Comments
 (0)