mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-24 02:47:52 +02:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user