On Sun, Jun 30, 2013 at 02:29:20PM +0900, Michael Paquier wrote: > On Sat, Jun 29, 2013 at 10:45 PM, Bruce Momjian <br...@momjian.us> wrote: > > In studying pg_upgrade's handling of --help, I noticed that pg_ctl > > supports -h for help, but it is the only tool to do so, and -h is not > > documented. I propose we remove -h for help in pg_ctl, and have it > > support only -? and --help. > I suppose that it doesn't hurt to have it, but for yes the sake of > consistency with the other binaries it would make sense to remove it. > Btw, not even the docs, it is also not listed in the --help message > findable in code.
Agreed --- attached patch applied. I also noticed that we sometimes test for -? then --help, but other times do things in the opposite order, and the same for -V/--version, so I made that consistent. However, I also noticed that while we document -? before --help, we test for --help before -?, and the same for -V/--version. Should I make those even more consistent by always testing for the single-letter option first? -- Bruce Momjian <br...@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. +
diff --git a/contrib/pg_test_fsync/pg_test_fsync.c b/contrib/pg_test_fsync/pg_test_fsync.c new file mode 100644 index b978d9e..53f600f *** a/contrib/pg_test_fsync/pg_test_fsync.c --- b/contrib/pg_test_fsync/pg_test_fsync.c *************** handle_args(int argc, char *argv[]) *** 146,153 **** if (argc > 1) { ! if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 || ! strcmp(argv[1], "-?") == 0) { printf("Usage: %s [-f FILENAME] [-s SECS-PER-TEST]\n", progname); exit(0); --- 146,152 ---- if (argc > 1) { ! if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0) { printf("Usage: %s [-f FILENAME] [-s SECS-PER-TEST]\n", progname); exit(0); diff --git a/contrib/pg_test_timing/pg_test_timing.c b/contrib/pg_test_timing/pg_test_timing.c new file mode 100644 index 0bf9127..e44c535 *** a/contrib/pg_test_timing/pg_test_timing.c --- b/contrib/pg_test_timing/pg_test_timing.c *************** handle_args(int argc, char *argv[]) *** 49,56 **** if (argc > 1) { ! if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 || ! strcmp(argv[1], "-?") == 0) { printf("Usage: %s [-d DURATION]\n", progname); exit(0); --- 49,55 ---- if (argc > 1) { ! if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0) { printf("Usage: %s [-d DURATION]\n", progname); exit(0); diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c new file mode 100644 index 9045e00..9e909ae *** a/src/bin/pg_ctl/pg_ctl.c --- b/src/bin/pg_ctl/pg_ctl.c *************** main(int argc, char **argv) *** 2002,2014 **** /* support --help and --version even if invoked as root */ if (argc > 1) { ! if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0 || ! strcmp(argv[1], "-?") == 0) { do_help(); exit(0); } ! else if (strcmp(argv[1], "-V") == 0 || strcmp(argv[1], "--version") == 0) { puts("pg_ctl (PostgreSQL) " PG_VERSION); exit(0); --- 2002,2013 ---- /* support --help and --version even if invoked as root */ if (argc > 1) { ! if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0) { do_help(); exit(0); } ! else if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0) { puts("pg_ctl (PostgreSQL) " PG_VERSION); exit(0); diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c new file mode 100644 index 1c9f7a5..b2264c9 *** a/src/bin/psql/startup.c --- b/src/bin/psql/startup.c *************** parse_psql_options(int argc, char *argv[ *** 558,564 **** break; case '?': /* Actual help option given */ ! if (strcmp(argv[optind - 1], "-?") == 0 || strcmp(argv[optind - 1], "--help") == 0) { usage(); exit(EXIT_SUCCESS); --- 558,564 ---- break; case '?': /* Actual help option given */ ! if (strcmp(argv[optind - 1], "--help") == 0 || strcmp(argv[optind - 1], "-?") == 0) { usage(); exit(EXIT_SUCCESS);
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers