mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-02 17:26:17 +01:00
Add a --version option to g-ir-compiler and g-ir-generate. Fixes #55
This commit is contained in:
parent
4c150f199e
commit
c24a174437
@ -41,6 +41,7 @@ main (int argc, char *argv[])
|
|||||||
GOptionContext *context;
|
GOptionContext *context;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean needs_prefix;
|
gboolean needs_prefix;
|
||||||
|
gboolean show_version = FALSE;
|
||||||
gint i;
|
gint i;
|
||||||
GOptionEntry options[] =
|
GOptionEntry options[] =
|
||||||
{
|
{
|
||||||
@ -48,6 +49,7 @@ main (int argc, char *argv[])
|
|||||||
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" },
|
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" },
|
||||||
{ "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, "include directories in GIR search path", NULL },
|
{ "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, "include directories in GIR search path", NULL },
|
||||||
{ "all", 0, 0, G_OPTION_ARG_NONE, &show_all, "show all available information", NULL, },
|
{ "all", 0, 0, G_OPTION_ARG_NONE, &show_all, "show all available information", NULL, },
|
||||||
|
{ "version", 0, 0, G_OPTION_ARG_NONE, &show_version, "show program's 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 },
|
||||||
{ NULL, }
|
{ NULL, }
|
||||||
};
|
};
|
||||||
@ -67,6 +69,13 @@ main (int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (show_version)
|
||||||
|
{
|
||||||
|
g_printf ("g-ir-generate %u.%u.%u\n",
|
||||||
|
GI_MAJOR_VERSION, GI_MINOR_VERSION, GI_MICRO_VERSION);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!input)
|
if (!input)
|
||||||
{
|
{
|
||||||
g_fprintf (stderr, "no input files\n");
|
g_fprintf (stderr, "no input files\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user