summaryrefslogtreecommitdiffstats
path: root/src/doc/build-man.sh
blob: 7b1330b58f7bf3206b9a5a089159314ec8b86ab9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#
# This script builds the Cargo man pages.
#
# The source for the man pages are located in src/doc/man/ in markdown format.
# These also are handlebars templates, see crates/mdman/README.md for details.
#
# The generated man pages are placed in the src/etc/man/ directory. The pages
# are also expanded into markdown (after being expanded by handlebars) and
# saved in the src/doc/src/commands/ directory. These are included in the
# Cargo book, which is converted to HTML by mdbook.

set -e

cd "$(dirname "${BASH_SOURCE[0]}")"

OPTIONS="--url https://doc.rust-lang.org/cargo/commands/ \
    --man rustc:1=https://doc.rust-lang.org/rustc/index.html \
    --man rustdoc:1=https://doc.rust-lang.org/rustdoc/index.html"

cargo run --manifest-path=../../crates/mdman/Cargo.toml -- \
    -t md -o src/commands man/cargo*.md \
    $OPTIONS

cargo run --manifest-path=../../crates/mdman/Cargo.toml -- \
    -t txt -o man/generated_txt man/cargo*.md \
    $OPTIONS

cargo run --manifest-path=../../crates/mdman/Cargo.toml -- \
    -t man -o ../etc/man man/cargo*.md \
    $OPTIONS