mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-04 03:03:51 +01:00
build: fix check-manpage.sh
Our formats changed, so this didn't work any more! Add a sanity check that in future if we get no options from a command, we complain. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
bcea0a9580
commit
9085293622
1 changed files with 10 additions and 4 deletions
|
@ -8,8 +8,9 @@ fi
|
||||||
|
|
||||||
get_cmd_opts()
|
get_cmd_opts()
|
||||||
{
|
{
|
||||||
# Trim out -- after first one (--option mentioned in help!)
|
# Trim out -- after first one: ensure width sufficient to give desc
|
||||||
$1 --help | grep '^\*' | sed 's/[ ].*--.*//' | while IFS=$'\n' read -r opt; do
|
# on same line, and ignore single-letter prefix e.g. -X|--ex
|
||||||
|
COLUMNS=1000 $1 --help | sed -n 's/^\(-.|\)\?\(--[^ ]*\)\( \| \).*/\2/p' | while IFS=$'\n' read -r opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
# We don't document dev options.
|
# We don't document dev options.
|
||||||
--dev*)
|
--dev*)
|
||||||
|
@ -27,10 +28,15 @@ get_cmd_opts()
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# If we don't get any, we failed!
|
||||||
CMD_OPTNAMES=$(get_cmd_opts "$1" | sort)
|
CMD_OPTNAMES=$(get_cmd_opts "$1" | sort)
|
||||||
|
if [ -z "$CMD_OPTNAMES" ]; then
|
||||||
|
echo "Failed to get options from $0!" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Now, gather (long) opt names from man page, make sure they match.
|
# Now, gather (long) opt names from man page, make sure they match.
|
||||||
MAN_OPTNAMES=$(sed -E -n 's/^ \*\*(--)?([^*/]*)\*\*(=?).*/\2\3/p' < "$2" | sort)
|
MAN_OPTNAMES=$(sed -E -n 's,^\* \*\*(--)?([^*/]*)\*\*(/\*\*-.\*\*)?(=?).*,\2\4,p' < "$2" | sort)
|
||||||
|
|
||||||
# Remove undocumented proprieties, usually these proprieties are
|
# Remove undocumented proprieties, usually these proprieties are
|
||||||
# under experimental phases.
|
# under experimental phases.
|
||||||
|
@ -44,6 +50,6 @@ done
|
||||||
|
|
||||||
if [ "$CMD_OPTNAMES" != "$MAN_OPTNAMES" ]; then
|
if [ "$CMD_OPTNAMES" != "$MAN_OPTNAMES" ]; then
|
||||||
echo "diff of command names vs manpage names":
|
echo "diff of command names vs manpage names":
|
||||||
diff -u <(echo "$CMD_OPTNAMES") <(echo "$MAN_OPTNAMES")
|
diff -u --label="$1" <(echo "$CMD_OPTNAMES") --label="$2" <(echo "$MAN_OPTNAMES")
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue