Skip to content

Commit d19583f

Browse files
committed
improved gen-manpages.sh, includes bitcoin-tx and strips commit tag, now also runs binaries from build dir by default, added variables for more control
1 parent 09546ca commit d19583f

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

contrib/devtools/gen-manpages.sh

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
#!/bin/sh
22

3-
# the autodetected version git tag at the end
4-
# can screw up manpage output a little bit
5-
BTCVER=$(bitcoin-cli --version | cut -d"-" -f1 | cut -d"v" -f3)
3+
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
4+
SRCDIR=${SRCDIR:-$TOPDIR/src}
5+
MANDIR=${MANDIR:-$TOPDIR/doc/man}
6+
7+
BITCOIND=${BITCOIND:-$SRCDIR/bitcoind}
8+
BITCOINCLI=${BITCOINCLI:-$SRCDIR/bitcoin-cli}
9+
BITCOINTX=${BITCOINTX:-$SRCDIR/bitcoin-tx}
10+
BITCOINQT=${BITCOINQT:-$SRCDIR/qt/bitcoin-qt}
11+
12+
[ ! -x $BITCOIND ] && echo "$BITCOIND not found or not executable." && exit 1
13+
14+
# The autodetected version git tag can screw up manpage output a little bit
15+
BTCVER=($($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ print $6, $7 }'))
616

717
# Create a footer file with copyright content.
8-
# This gets autodetected fine for bitcoind if
9-
# --version-string is not set, but has different
10-
# outcomes for bitcoin-qt and bitcoin-cli.
18+
# This gets autodetected fine for bitcoind if --version-string is not set,
19+
# but has different outcomes for bitcoin-qt and bitcoin-cli.
1120
echo "[COPYRIGHT]" > footer.h2m
12-
bitcoind --version | sed -n '1!p' >> footer.h2m
21+
$BITCOIND --version | sed -n '1!p' >> footer.h2m
1322

14-
for cmd in bitcoind bitcoin-qt bitcoin-cli; do
15-
help2man -N --version-string=${BTCVER} --include=footer.h2m -o ../../doc/man/${cmd}.1 ${cmd}
23+
for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $BITCOINQT; do
24+
cmdname="${cmd##*/}"
25+
help2man -N --version-string=${BTCVER[0]} --include=footer.h2m -o ${MANDIR}/${cmdname}.1 ${cmd}
26+
sed -i "s/\\\-${BTCVER[1]}//g" ${MANDIR}/${cmdname}.1
1627
done
1728

1829
rm -f footer.h2m

0 commit comments

Comments
 (0)