Commit 2cb2a617 authored by Ondrej Holy's avatar Ondrej Holy

gio-tool: Print help if no arguments are given

Help is usually printed from tools if no arguments are given and there
is not default action. However "gio mount" and "gio trash" just silently
return. Let's print "No locations given" error and show help consistently.
parent bc365c9b
Pipeline #13199 passed with stages
in 38 minutes and 20 seconds
......@@ -1160,8 +1160,6 @@ handle_mount (int argc, char *argv[], gboolean do_help)
return 1;
}
g_option_context_free (context);
main_loop = g_main_loop_new (NULL, FALSE);
if (mount_list)
......@@ -1186,6 +1184,14 @@ handle_mount (int argc, char *argv[], gboolean do_help)
g_object_unref (file);
}
}
else
{
show_help (context, _("No locations given"));
g_option_context_free (context);
return 1;
}
g_option_context_free (context);
if (outstanding_mounts > 0)
g_main_loop_run (main_loop);
......
......@@ -101,8 +101,6 @@ handle_trash (int argc, char *argv[], gboolean do_help)
return 1;
}
g_option_context_free (context);
if (argc > 1)
{
int i;
......@@ -133,5 +131,14 @@ handle_trash (int argc, char *argv[], gboolean do_help)
g_object_unref (file);
}
if (argc == 1 && !empty)
{
show_help (context, _("No locations given"));
g_option_context_free (context);
return 1;
}
g_option_context_free (context);
return retval;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment