mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
doc: Add manual page generation for bitcoin-util
- Add `-version` option to `bitcoin-util` - Add `bitcoin-util` call to `gen-manpages.sh` - Add stub manual page `bitcoin-util.1` - Add install of `bitcoin-util.1` to build system
This commit is contained in:
parent
7b975639ef
commit
b5e93f873a
4 changed files with 21 additions and 7 deletions
|
@ -14,13 +14,14 @@ BITCOIND=${BITCOIND:-$BINDIR/bitcoind}
|
|||
BITCOINCLI=${BITCOINCLI:-$BINDIR/bitcoin-cli}
|
||||
BITCOINTX=${BITCOINTX:-$BINDIR/bitcoin-tx}
|
||||
WALLET_TOOL=${WALLET_TOOL:-$BINDIR/bitcoin-wallet}
|
||||
BITCOINUTIL=${BITCOINQT:-$BINDIR/bitcoin-util}
|
||||
BITCOINQT=${BITCOINQT:-$BINDIR/qt/bitcoin-qt}
|
||||
|
||||
[ ! -x $BITCOIND ] && echo "$BITCOIND not found or not executable." && exit 1
|
||||
|
||||
# Don't allow man pages to be generated for binaries built from a dirty tree
|
||||
DIRTY=""
|
||||
for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $WALLET_TOOL $BITCOINQT; do
|
||||
for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $WALLET_TOOL $BITCOINUTIL $BITCOINQT; do
|
||||
VERSION_OUTPUT=$($cmd --version)
|
||||
if [[ $VERSION_OUTPUT == *"dirty"* ]]; then
|
||||
DIRTY="${DIRTY}${cmd}\n"
|
||||
|
@ -43,7 +44,7 @@ read -r -a BTCVER <<< "$($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ prin
|
|||
echo "[COPYRIGHT]" > footer.h2m
|
||||
$BITCOIND --version | sed -n '1!p' >> footer.h2m
|
||||
|
||||
for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $WALLET_TOOL $BITCOINQT; do
|
||||
for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $WALLET_TOOL $BITCOINUTIL $BITCOINQT; do
|
||||
cmdname="${cmd##*/}"
|
||||
help2man -N --version-string=${BTCVER[0]} --include=footer.h2m -o ${MANDIR}/${cmdname}.1 ${cmd}
|
||||
sed -i "s/\\\-${BTCVER[1]}//g" ${MANDIR}/${cmdname}.1
|
||||
|
|
|
@ -16,6 +16,10 @@ if BUILD_BITCOIN_TX
|
|||
dist_man1_MANS+=bitcoin-tx.1
|
||||
endif
|
||||
|
||||
if BUILD_BITCOIN_UTIL
|
||||
dist_man1_MANS+=bitcoin-util.1
|
||||
endif
|
||||
|
||||
if ENABLE_WALLET
|
||||
if BUILD_BITCOIN_WALLET
|
||||
dist_man1_MANS+=bitcoin-wallet.1
|
||||
|
|
5
doc/man/bitcoin-util.1
Normal file
5
doc/man/bitcoin-util.1
Normal file
|
@ -0,0 +1,5 @@
|
|||
.TH BITCOIN-UTIL "1"
|
||||
.SH NAME
|
||||
bitcoin-util \- manual page for bitcoin-util
|
||||
|
||||
This is a placefolder file. Please follow the instructions in \fIcontrib/devtools/README.md\fR to generate the manual pages after a release.
|
|
@ -40,6 +40,8 @@ static void SetupBitcoinUtilArgs(ArgsManager &argsman)
|
|||
{
|
||||
SetupHelpOptions(argsman);
|
||||
|
||||
argsman.AddArg("-version", "Print version and exit", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
||||
|
||||
SetupChainParamsBaseOptions(argsman);
|
||||
}
|
||||
|
||||
|
@ -62,12 +64,14 @@ static int AppInitUtil(int argc, char* argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (argc < 2 || HelpRequested(gArgs)) {
|
||||
if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
|
||||
// First part of help message is specific to this utility
|
||||
std::string strUsage = PACKAGE_NAME " bitcoin-util utility version " + FormatFullVersion() + "\n\n" +
|
||||
"Usage: bitcoin-util [options] [commands] Do stuff\n" +
|
||||
"\n";
|
||||
strUsage += gArgs.GetHelpMessage();
|
||||
std::string strUsage = PACKAGE_NAME " bitcoin-util utility version " + FormatFullVersion() + "\n";
|
||||
if (!gArgs.IsArgSet("-version")) {
|
||||
strUsage += "\n"
|
||||
"Usage: bitcoin-util [options] [commands] Do stuff\n";
|
||||
strUsage += "\n" + gArgs.GetHelpMessage();
|
||||
}
|
||||
|
||||
tfm::format(std::cout, "%s", strUsage);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue