Skip to content

Commit a698467

Browse files
committed
chore(ci): allow to set version and date when generating manpage
1 parent 998dcfd commit a698467

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

ci/build_manpage.sh

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
pandoc man/bombadil.1.md -s -t man
4+
TEMP_FILE=/tmp/bombadil_man.md
5+
6+
while getopts v:d:i:o: option
7+
do
8+
case "${option}"
9+
in
10+
v) VERSION=${OPTARG};;
11+
d) DATE=${OPTARG};;
12+
i) INPUT_PATH=${OPTARG};;
13+
o) OUTPUT_PATH=${OPTARG};;
14+
*) echo "invalid flag"
15+
esac
16+
done
17+
18+
echo -e "Creating temporary file"
19+
cp "$INPUT_PATH" "$TEMP_FILE"
20+
21+
echo -e "Setting version to $VERSION"
22+
sed -i -e "s/{{version}}/$VERSION/g" "$TEMP_FILE"
23+
echo -e "Setting date released to $DATE"
24+
sed -i -e "s/{{date_released}}/$DATE/g" "$TEMP_FILE"
25+
26+
pandoc "$TEMP_FILE" -s -t man > "$OUTPUT_PATH"

man/bombadil.1.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
% BOMBADIL(1) bombadil 1.11.2
1+
% BOMBADIL(1) bombadil {{version}}
22
% Paul Delafosse
3-
% Oct 2020
3+
% {{date_released}}
44

55
# NAME
66

0 commit comments

Comments
 (0)