mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-24 21:16:15 +01:00
glib-compile-resources: Add a --version option
There have been some improvements to the tool recently, but it's hard to know if those are available on a given system unless the tool provides a --version commandline option. https://bugzilla.gnome.org/show_bug.cgi?id=772269
This commit is contained in:
parent
e048d31210
commit
bce8b6db8d
@ -56,6 +56,13 @@ Print help and exit
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--version</option></term>
|
||||
<listitem><para>
|
||||
Print program version and exit
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--target=<replaceable>TARGET</replaceable></option></term>
|
||||
<listitem><para>
|
||||
|
@ -603,6 +603,7 @@ main (int argc, char **argv)
|
||||
GHashTable *table;
|
||||
GHashTable *files;
|
||||
gchar *srcfile;
|
||||
gboolean show_version_and_exit = FALSE;
|
||||
gchar *target = NULL;
|
||||
gchar *binary_target = NULL;
|
||||
gboolean generate_automatic = FALSE;
|
||||
@ -617,6 +618,7 @@ main (int argc, char **argv)
|
||||
const char *linkage = "extern";
|
||||
GOptionContext *context;
|
||||
GOptionEntry entries[] = {
|
||||
{ "version", 0, 0, G_OPTION_ARG_NONE, &show_version_and_exit, N_("Show program version and exit"), NULL },
|
||||
{ "target", 0, 0, G_OPTION_ARG_FILENAME, &target, N_("name of the output file"), N_("FILE") },
|
||||
{ "sourcedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &sourcedirs, N_("The directories where files are to be read from (default to current directory)"), N_("DIRECTORY") },
|
||||
{ "generate", 0, 0, G_OPTION_ARG_NONE, &generate_automatic, N_("Generate output in the format selected for by the target filename extension"), NULL },
|
||||
@ -666,6 +668,12 @@ main (int argc, char **argv)
|
||||
|
||||
g_option_context_free (context);
|
||||
|
||||
if (show_version_and_exit)
|
||||
{
|
||||
g_print (PACKAGE_VERSION "\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
g_printerr (_("You should give exactly one file name\n"));
|
||||
|
Loading…
Reference in New Issue
Block a user