mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
virt-ssh-helper: Improve usage information
Specifically: * include non-option argument 'URI' in usage summary; * mention that it's an internal tool not meant to be called directly; * exit earlier if required arguments are absent. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
a4941a0c27
commit
8b8fee8fe2
@ -369,7 +369,10 @@ int main(int argc, char **argv)
|
|||||||
};
|
};
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
|
||||||
context = g_option_context_new("- libvirt socket proxy");
|
context = g_option_context_new("URI - libvirt socket proxy");
|
||||||
|
g_option_context_set_summary(context,
|
||||||
|
"Internal tool used to handle connections coming from remote\n"
|
||||||
|
"clients. Not intended to be called directly by the user.");
|
||||||
g_option_context_add_main_entries(context, entries, PACKAGE);
|
g_option_context_add_main_entries(context, entries, PACKAGE);
|
||||||
if (!g_option_context_parse(context, &argc, &argv, &error)) {
|
if (!g_option_context_parse(context, &argc, &argv, &error)) {
|
||||||
g_printerr(_("option parsing failed: %s\n"), error->message);
|
g_printerr(_("option parsing failed: %s\n"), error->message);
|
||||||
@ -381,6 +384,12 @@ int main(int argc, char **argv)
|
|||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argc != 2) {
|
||||||
|
g_autofree char *help = g_option_context_get_help(context, TRUE, NULL);
|
||||||
|
g_printerr("%s", help);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
virSetErrorFunc(NULL, NULL);
|
virSetErrorFunc(NULL, NULL);
|
||||||
virSetErrorLogPriorityFunc(NULL);
|
virSetErrorLogPriorityFunc(NULL);
|
||||||
|
|
||||||
@ -395,11 +404,6 @@ int main(int argc, char **argv)
|
|||||||
/* Initialize the log system */
|
/* Initialize the log system */
|
||||||
virLogSetFromEnv();
|
virLogSetFromEnv();
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
g_printerr("%s: expected a URI\n", argv[0]);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
uri_str = argv[1];
|
uri_str = argv[1];
|
||||||
VIR_DEBUG("Using URI %s", uri_str);
|
VIR_DEBUG("Using URI %s", uri_str);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user