Merge branch 'wip/smcv/cli-placeholders' into 'main'

Add missing argument placeholders to several command-line tools

See merge request GNOME/glib!3946
This commit is contained in:
Philip Withnall 2024-02-29 10:39:53 +00:00
commit 8618f50d16
4 changed files with 12 additions and 7 deletions

View File

@ -404,7 +404,7 @@ static const GOptionEntry connection_entries[] =
{ {
{ "system", 'y', 0, G_OPTION_ARG_NONE, &opt_connection_system, N_("Connect to the system bus"), NULL}, { "system", 'y', 0, G_OPTION_ARG_NONE, &opt_connection_system, N_("Connect to the system bus"), NULL},
{ "session", 'e', 0, G_OPTION_ARG_NONE, &opt_connection_session, N_("Connect to the session bus"), NULL}, { "session", 'e', 0, G_OPTION_ARG_NONE, &opt_connection_session, N_("Connect to the session bus"), NULL},
{ "address", 'a', 0, G_OPTION_ARG_STRING, &opt_connection_address, N_("Connect to given D-Bus address"), NULL}, { "address", 'a', 0, G_OPTION_ARG_STRING, &opt_connection_address, N_("Connect to given D-Bus address"), N_("ADDRESS") },
G_OPTION_ENTRY_NULL G_OPTION_ENTRY_NULL
}; };

View File

@ -830,8 +830,8 @@ main (int argc, char **argv)
{ "manual-register", 0, 0, G_OPTION_ARG_NONE, &manual_register, N_("Dont automatically create and register resource"), NULL }, { "manual-register", 0, 0, G_OPTION_ARG_NONE, &manual_register, N_("Dont automatically create and register resource"), NULL },
{ "internal", 0, 0, G_OPTION_ARG_NONE, &internal, N_("Dont export functions; declare them G_GNUC_INTERNAL"), NULL }, { "internal", 0, 0, G_OPTION_ARG_NONE, &internal, N_("Dont export functions; declare them G_GNUC_INTERNAL"), NULL },
{ "external-data", 0, 0, G_OPTION_ARG_NONE, &external_data, N_("Dont embed resource data in the C file; assume it's linked externally instead"), NULL }, { "external-data", 0, 0, G_OPTION_ARG_NONE, &external_data, N_("Dont embed resource data in the C file; assume it's linked externally instead"), NULL },
{ "c-name", 0, 0, G_OPTION_ARG_STRING, &c_name, N_("C identifier name used for the generated source code"), NULL }, { "c-name", 0, 0, G_OPTION_ARG_STRING, &c_name, N_("C identifier name used for the generated source code"), N_("IDENTIFIER") },
{ "compiler", 'C', 0, G_OPTION_ARG_STRING, &compiler, N_("The target C compiler (default: the CC environment variable)"), NULL }, { "compiler", 'C', 0, G_OPTION_ARG_STRING, &compiler, N_("The target C compiler (default: the CC environment variable)"), N_("COMMAND") },
G_OPTION_ENTRY_NULL G_OPTION_ENTRY_NULL
}; };

View File

@ -144,7 +144,7 @@ log_handler (const gchar *log_domain,
} }
static GOptionEntry options[] = { static GOptionEntry options[] = {
{ "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, N_("Include directories in GIR search path"), NULL }, { "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, N_("Include directories in GIR search path"), N_("DIRECTORY") },
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, N_("Output file"), N_("FILE") }, { "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, N_("Output file"), N_("FILE") },
{ "shared-library", 'l', 0, G_OPTION_ARG_FILENAME_ARRAY, &shlibs, N_("Shared library"), N_("FILE") }, { "shared-library", 'l', 0, G_OPTION_ARG_FILENAME_ARRAY, &shlibs, N_("Shared library"), N_("FILE") },
{ "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Show debug messages"), NULL }, { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Show debug messages"), NULL },
@ -164,7 +164,8 @@ main (int argc, char **argv)
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
context = g_option_context_new (""); /* Translators: commandline placeholder */
context = g_option_context_new (_("FILE"));
g_option_context_add_main_entries (context, options, NULL); g_option_context_add_main_entries (context, options, NULL);
g_option_context_parse (context, &argc, &argv, &error); g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context); g_option_context_free (context);

View File

@ -37,6 +37,7 @@ int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
GIRepository *repository = NULL; GIRepository *repository = NULL;
gchar *param;
gchar *output = NULL; gchar *output = NULL;
gchar **includedirs = NULL; gchar **includedirs = NULL;
gboolean show_all = FALSE; gboolean show_all = FALSE;
@ -49,7 +50,7 @@ main (int argc, char *argv[])
GOptionEntry options[] = GOptionEntry options[] =
{ {
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, N_("Output file"), N_("FILE") }, { "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, N_("Output file"), N_("FILE") },
{ "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, N_("Include directories in GIR search path"), NULL }, { "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, N_("Include directories in GIR search path"), N_("DIRECTORY") },
{ "all", 0, 0, G_OPTION_ARG_NONE, &show_all, N_("Show all available information"), NULL, }, { "all", 0, 0, G_OPTION_ARG_NONE, &show_all, N_("Show all available information"), NULL, },
{ "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show programs version number and exit"), NULL }, { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show programs version number and exit"), NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input, NULL, NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input, NULL, NULL },
@ -60,7 +61,10 @@ main (int argc, char *argv[])
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
context = g_option_context_new (""); /* Translators: commandline placeholder */
param = g_strdup_printf ("%s…", _("FILE"));
context = g_option_context_new (param);
g_free (param);
g_option_context_add_main_entries (context, options, NULL); g_option_context_add_main_entries (context, options, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error)) if (!g_option_context_parse (context, &argc, &argv, &error))
{ {