tools/check-manpage.sh: update undoc to a simple list.

It didn't handle the case where an undocumented option was
was a flag (i.e. didn't end in =), so rework it to be
a simple list and use grep.

Add some more options we don't document, too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-08-18 16:19:16 +09:30
parent b03358e933
commit 93d8e10786
3 changed files with 32 additions and 31 deletions

View File

@ -1,20 +0,0 @@
{
"flags": [
"channel-fee-max-base-msat",
"channel-fee-max-proportional-thousandths",
"funder-fund-probability",
"funder-fuzz-percent",
"funder-lease-requests-only",
"funder-max-their-funding",
"funder-min-their-funding",
"funder-per-channel-max",
"funder-per-channel-min",
"funder-policy",
"funder-policy-mod",
"funder-reserve-tank",
"lease-fee-base-sat",
"lease-fee-base-msat",
"lease-fee-basis",
"lease-funding-weight"
]
}

21
doc/undoc-flags.list Normal file
View File

@ -0,0 +1,21 @@
list-features-only
test-daemons-only
renepay-debug-mcf
renepay-debug-payflow
require-confirmed-inputs=
channel-fee-max-base-msat=
channel-fee-max-proportional-thousandths=
funder-fund-probability=
funder-fuzz-percent=
funder-lease-requests-only=
funder-max-their-funding=
funder-min-their-funding=
funder-per-channel-max=
funder-per-channel-min=
funder-policy=
funder-policy-mod=
funder-reserve-tank=
lease-fee-base-sat=
lease-fee-base-msat=
lease-fee-basis=
lease-funding-weight=

View File

@ -28,8 +28,18 @@ get_cmd_opts()
done
}
# Remove undocumented proprieties, usually these proprieties are
# under experimental phases.
remove_undoc()
{
# shellcheck disable=SC2162
while read OPT; do
grep -q "^$OPT$" < doc/undoc-flags.list || echo "$OPT"
done
}
# If we don't get any, we failed!
CMD_OPTNAMES=$(get_cmd_opts "$1" | sort)
CMD_OPTNAMES=$(get_cmd_opts "$1" | sort | remove_undoc)
if [ -z "$CMD_OPTNAMES" ]; then
echo "Failed to get options from $0!" >&2
exit 1
@ -38,16 +48,6 @@ fi
# Now, gather (long) opt names from man page, make sure they match.
MAN_OPTNAMES=$(grep -vi 'deprecated in' "$2" | sed -E -n 's,^\* \*\*(--)?([^*/]*)\*\*(/\*\*-.\*\*)?(=?).*,\2\4,p'| sort)
# Remove undocumented proprieties, usually these proprieties are
# under experimental phases.
for flag in $(jq '.flags[]' <doc/undoc-flags.json) ; do
# Remove the quotes from the string, so the code will remove
# the first and last char in the string.
FLAG=$(sed 's/.//;s/.$//' <(echo "$flag"))
CMD_OPTNAMES=$(sed "/$FLAG=/d" <(echo "$CMD_OPTNAMES"))
done
if [ "$CMD_OPTNAMES" != "$MAN_OPTNAMES" ]; then
echo "diff of command names vs manpage names":
diff -u --label="$1" <(echo "$CMD_OPTNAMES") --label="$2" <(echo "$MAN_OPTNAMES")