repmgr: exit with an error if an unrecognised command line option is provided.

This matches the behaviour of other PostgreSQL utilities such as psql, though
repmgr will only abort once all command line options are parsed, so as many
errors as possible are found and displayed. If a repmgr "command" (e.g.
"repmgr primary ..." was provided, a hint about the relevant command
help section (e.g. "repmgr primary --help") will be provided alongside
the generic help command (i.e. "repmgr --help").

Addresses GitHub #464, with further improvements.
This commit is contained in:
Ian Barwick
2018-07-04 11:02:50 +09:00
parent c4f9205f17
commit a194cf56b3
6 changed files with 69 additions and 14 deletions

View File

@@ -237,7 +237,7 @@ main(int argc, char **argv)
/* Exit here already if errors in command line options found */
if (cli_errors.head != NULL)
{
exit_with_cli_errors(&cli_errors);
exit_with_cli_errors(&cli_errors, NULL);
}
startup_event_logged = false;