On Tue, Jun 24, 2025 at 6:16 PM Bruno Haible via Gnulib discussion list <bug-gnulib@gnu.org> wrote: > > I propose to add to getopt_long() — in Gnulib — code that verifies > the consistency between the two places, when a certain environment > variable (say, GETOPT_DEBUG) is set. And produces output on stderr > such as: > getopt_long: warning: option '--context' requires an argument but option > '-c' takes no argument.
Another approach would be to provide a function that dynamically generates the shortopts argument to pass getopt_long(), given the long options. Then there would be less work and less to keep consistent for developers.