MXS-1409: Improve MaxAdmin error messages

If both socket and network options are listed, a clear error message is
printed. The usage is also split into two lines to make it clear that the
options should be used separately.
This commit is contained in:
Markus Mäkelä
2017-09-16 07:44:25 +03:00
parent 9267f8ad70
commit d003983e5a

View File

@ -200,6 +200,7 @@ main(int argc, char **argv)
{ {
// Both unix socket path and at least of the internet socket // Both unix socket path and at least of the internet socket
// options have been provided. // options have been provided.
printf("\nError: Both socket and network options are provided\n\n");
DoUsage(argv[0]); DoUsage(argv[0]);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -812,8 +813,8 @@ DoUsage(const char *progname)
{ {
PrintVersion(progname); PrintVersion(progname);
printf("The MaxScale administrative and monitor client.\n\n"); printf("The MaxScale administrative and monitor client.\n\n");
printf("Usage: %s [(-S socket)|([-u user] [-p password] [-h hostname] [-P port])]" printf("Usage: %s [-S socket] <command>\n", progname);
"[<command file> | <command>]\n\n", progname); printf(" %s [-u user] [-p password] [-h hostname] [-P port] <command>\n\n", progname);
printf(" -S|--socket=... The UNIX domain socket to connect to, The default is\n"); printf(" -S|--socket=... The UNIX domain socket to connect to, The default is\n");
printf(" %s\n", MAXADMIN_DEFAULT_SOCKET); printf(" %s\n", MAXADMIN_DEFAULT_SOCKET);
printf(" -u|--user=... The user name to use for the connection, default\n"); printf(" -u|--user=... The user name to use for the connection, default\n");