On 2015-04-03 19:06:38 -0300, Alvaro Herrera wrote:
> The thing I hate the most about this issue is how some commands fail
> with "--help: unrecognized option" or some such, when called as
>
> command --foo=bar --baz --help
I think that's primarily a different issue though. For some reason I
have yet to figure out --help is usually treated explicitly. E.g.:
if (argc > 1)
{
if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
{
usage();
exit(0);
}
else if (strcmp(argv[1], "-V") == 0
|| strcmp(argv[1], "--version") == 0)
{
puts("pg_basebackup (PostgreSQL) " PG_VERSION);
exit(0);
}
}
while ((c = getopt_long(argc, argv, "D:F:r:RT:xX:l:zZ:d:c:h:p:U:s:wWvP",
long_options, &option_index)) != -1)
Some tools then copy the --help/-? handling to the normal option parsing
(like IIRC psql) but others don't (like pg_basebackup).
Greetings,
Andres Freund