Merge branch 'wip/oholy/gio-tool-arguments' into 'master'

Fix some inconsistencies regarding arguments in gio-tool

See merge request GNOME/glib!18
This commit is contained in:
Philip Withnall 2018-05-28 13:40:29 +00:00
commit 2b4c962541
14 changed files with 31 additions and 18 deletions

View File

@ -130,7 +130,7 @@ handle_cat (int argc, char *argv[], gboolean do_help)
g_set_prgname ("gio cat"); g_set_prgname ("gio cat");
/* Translators: commandline placeholder */ /* Translators: commandline placeholder */
param = g_strdup_printf ("%s...", _("LOCATION")); param = g_strdup_printf ("%s", _("LOCATION"));
context = g_option_context_new (param); context = g_option_context_new (param);
g_free (param); g_free (param);
g_option_context_set_help_enabled (context, FALSE); g_option_context_set_help_enabled (context, FALSE);

View File

@ -95,7 +95,7 @@ handle_copy (int argc, char *argv[], gboolean do_help)
g_set_prgname ("gio copy"); g_set_prgname ("gio copy");
/* Translators: commandline placeholder */ /* Translators: commandline placeholder */
param = g_strdup_printf ("%s... %s", _("SOURCE"), _("DESTINATION")); param = g_strdup_printf ("%s %s", _("SOURCE"), _("DESTINATION"));
context = g_option_context_new (param); context = g_option_context_new (param);
g_free (param); g_free (param);
g_option_context_set_help_enabled (context, FALSE); g_option_context_set_help_enabled (context, FALSE);

View File

@ -279,7 +279,7 @@ handle_info (int argc, char *argv[], gboolean do_help)
g_set_prgname ("gio info"); g_set_prgname ("gio info");
/* Translators: commandline placeholder */ /* Translators: commandline placeholder */
param = g_strdup_printf ("%s...", _("LOCATION")); param = g_strdup_printf ("%s", _("LOCATION"));
context = g_option_context_new (param); context = g_option_context_new (param);
g_free (param); g_free (param);
g_option_context_set_help_enabled (context, FALSE); g_option_context_set_help_enabled (context, FALSE);

View File

@ -162,7 +162,7 @@ handle_list (int argc, char *argv[], gboolean do_help)
g_set_prgname ("gio list"); g_set_prgname ("gio list");
/* Translators: commandline placeholder */ /* Translators: commandline placeholder */
param = g_strdup_printf ("[%s...]", _("LOCATION")); param = g_strdup_printf ("[%s]", _("LOCATION"));
context = g_option_context_new (param); context = g_option_context_new (param);
g_free (param); g_free (param);
g_option_context_set_help_enabled (context, FALSE); g_option_context_set_help_enabled (context, FALSE);

View File

@ -45,7 +45,7 @@ handle_mkdir (int argc, char *argv[], gboolean do_help)
g_set_prgname ("gio mkdir"); g_set_prgname ("gio mkdir");
/* Translators: commandline placeholder */ /* Translators: commandline placeholder */
param = g_strdup_printf ("%s...", _("LOCATION")); param = g_strdup_printf ("%s", _("LOCATION"));
context = g_option_context_new (param); context = g_option_context_new (param);
g_free (param); g_free (param);
g_option_context_set_help_enabled (context, FALSE); g_option_context_set_help_enabled (context, FALSE);

View File

@ -200,7 +200,7 @@ handle_monitor (int argc, gchar *argv[], gboolean do_help)
g_set_prgname ("gio monitor"); g_set_prgname ("gio monitor");
/* Translators: commandline placeholder */ /* Translators: commandline placeholder */
param = g_strdup_printf ("[%s...]", _("LOCATION")); param = g_strdup_printf ("%s…", _("LOCATION"));
context = g_option_context_new (param); context = g_option_context_new (param);
g_free (param); g_free (param);
g_option_context_set_help_enabled (context, FALSE); g_option_context_set_help_enabled (context, FALSE);

View File

@ -1138,7 +1138,7 @@ handle_mount (int argc, char *argv[], gboolean do_help)
g_set_prgname ("gio mount"); g_set_prgname ("gio mount");
/* Translators: commandline placeholder */ /* Translators: commandline placeholder */
param = g_strdup_printf ("[%s...]", _("LOCATION")); param = g_strdup_printf ("[%s]", _("LOCATION"));
context = g_option_context_new (param); context = g_option_context_new (param);
g_free (param); g_free (param);
g_option_context_set_help_enabled (context, FALSE); g_option_context_set_help_enabled (context, FALSE);
@ -1160,8 +1160,6 @@ handle_mount (int argc, char *argv[], gboolean do_help)
return 1; return 1;
} }
g_option_context_free (context);
main_loop = g_main_loop_new (NULL, FALSE); main_loop = g_main_loop_new (NULL, FALSE);
if (mount_list) if (mount_list)
@ -1186,6 +1184,14 @@ handle_mount (int argc, char *argv[], gboolean do_help)
g_object_unref (file); 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) if (outstanding_mounts > 0)
g_main_loop_run (main_loop); g_main_loop_run (main_loop);

View File

@ -91,7 +91,7 @@ handle_move (int argc, char *argv[], gboolean do_help)
g_set_prgname ("gio move"); g_set_prgname ("gio move");
/* Translators: commandline placeholder */ /* Translators: commandline placeholder */
param = g_strdup_printf ("%s... %s", _("SOURCE"), _("DESTINATION")); param = g_strdup_printf ("%s %s", _("SOURCE"), _("DESTINATION"));
context = g_option_context_new (param); context = g_option_context_new (param);
g_free (param); g_free (param);
g_option_context_set_help_enabled (context, FALSE); g_option_context_set_help_enabled (context, FALSE);

View File

@ -110,7 +110,7 @@ handle_open (int argc, char *argv[], gboolean do_help)
g_set_prgname ("gio open"); g_set_prgname ("gio open");
/* Translators: commandline placeholder */ /* Translators: commandline placeholder */
param = g_strdup_printf ("%s...", _("LOCATION")); param = g_strdup_printf ("%s", _("LOCATION"));
context = g_option_context_new (param); context = g_option_context_new (param);
g_free (param); g_free (param);
g_option_context_set_help_enabled (context, FALSE); g_option_context_set_help_enabled (context, FALSE);

View File

@ -45,7 +45,7 @@ handle_remove (int argc, char *argv[], gboolean do_help)
g_set_prgname ("gio remove"); g_set_prgname ("gio remove");
/* Translators: commandline placeholder */ /* Translators: commandline placeholder */
param = g_strdup_printf ("%s...", _("LOCATION")); param = g_strdup_printf ("%s", _("LOCATION"));
context = g_option_context_new (param); context = g_option_context_new (param);
g_free (param); g_free (param);
g_option_context_set_help_enabled (context, FALSE); g_option_context_set_help_enabled (context, FALSE);

View File

@ -86,7 +86,7 @@ handle_set (int argc, char *argv[], gboolean do_help)
g_set_prgname ("gio set"); g_set_prgname ("gio set");
/* Translators: commandline placeholder */ /* Translators: commandline placeholder */
param = g_strdup_printf ("%s %s %s...", _("LOCATION"), _("ATTRIBUTE"), _("VALUE")); param = g_strdup_printf ("%s %s %s", _("LOCATION"), _("ATTRIBUTE"), _("VALUE"));
context = g_option_context_new (param); context = g_option_context_new (param);
g_free (param); g_free (param);
g_option_context_set_help_enabled (context, FALSE); g_option_context_set_help_enabled (context, FALSE);

View File

@ -78,7 +78,7 @@ handle_trash (int argc, char *argv[], gboolean do_help)
g_set_prgname ("gio trash"); g_set_prgname ("gio trash");
/* Translators: commandline placeholder */ /* Translators: commandline placeholder */
param = g_strdup_printf ("[%s...]", _("LOCATION")); param = g_strdup_printf ("[%s]", _("LOCATION"));
context = g_option_context_new (param); context = g_option_context_new (param);
g_free (param); g_free (param);
g_option_context_set_help_enabled (context, FALSE); g_option_context_set_help_enabled (context, FALSE);
@ -101,8 +101,6 @@ handle_trash (int argc, char *argv[], gboolean do_help)
return 1; return 1;
} }
g_option_context_free (context);
if (argc > 1) if (argc > 1)
{ {
int i; int i;
@ -133,5 +131,14 @@ handle_trash (int argc, char *argv[], gboolean do_help)
g_object_unref (file); 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; return retval;
} }

View File

@ -236,7 +236,7 @@ handle_tree (int argc, char *argv[], gboolean do_help)
g_set_prgname ("gio tree"); g_set_prgname ("gio tree");
/* Translators: commandline placeholder */ /* Translators: commandline placeholder */
param = g_strdup_printf ("[%s...]", _("LOCATION")); param = g_strdup_printf ("[%s]", _("LOCATION"));
context = g_option_context_new (param); context = g_option_context_new (param);
g_free (param); g_free (param);
g_option_context_set_help_enabled (context, FALSE); g_option_context_set_help_enabled (context, FALSE);

View File

@ -221,7 +221,7 @@ static void
usage (void) usage (void)
{ {
g_printerr ("%s\n", _("Usage:")); g_printerr ("%s\n", _("Usage:"));
g_printerr (" gio %s %s\n", _("COMMAND"), _("[ARGS...]")); g_printerr (" gio %s %s\n", _("COMMAND"), _("[ARGS]"));
g_printerr ("\n"); g_printerr ("\n");
g_printerr ("%s\n", _("Commands:")); g_printerr ("%s\n", _("Commands:"));
g_printerr (" help %s\n", _("Print help")); g_printerr (" help %s\n", _("Print help"));