On 14/11/2025 19:47, Collin Funk wrote:
Pádraig Brady <[email protected]> writes:

* doc/coreutils.texi (wc invocation): Desscribe --debug.
* src/wc.c (usage): Likewise.
* NEWS: Mention the bug fix.
---
  NEWS               | 4 ++++
  doc/coreutils.texi | 5 +++++
  src/wc.c           | 3 +++
  3 files changed, 12 insertions(+)

Looks good.

It would be nice to have some syntax-check to check the
"struct long_options" array and make sure all of them are documented in
--help and in the manual.

I guess there is some options we purposefully don't document, though. I
assume we exclude --rfc-2822 and --rfc-822 from 'date --help' since it
is the same as 'date --rfc-email', for example.

Good idea, Off the top of my head something based on the following might work:

  getopts() { sed -n '/longopts\[/,/^}/p' src/$1.c; }
  shortopts() { getopts $1 | cut -s -d"'" -f2; }
  longopts() { getopts $1 | cut -s -d'"' -f2; }
  cmd=wc
  for opt in $(longopts $cmd) $(shortopts $cmd); do
    echo checking $cmd $opt
    src/$cmd --help | grep -F -- -$opt >/dev/null ||
      printf '--%s missing\n' $opt
  done

cheers,
Padraig

Reply via email to