Add a --version option to g-ir-compiler and g-ir-generate. Fixes #55

This commit is contained in:
Christoph Reiter 2018-12-16 13:42:27 +01:00 committed by Evan Welsh
parent 496669495c
commit 98daf20188

View File

@ -45,6 +45,7 @@ gchar **shlibs = NULL;
gboolean include_cwd = FALSE;
gboolean debug = FALSE;
gboolean verbose = FALSE;
gboolean show_version = FALSE;
static gboolean
write_out_typelib (gchar *prefix,
@ -135,6 +136,7 @@ static GOptionEntry options[] =
{ "shared-library", 'l', 0, G_OPTION_ARG_FILENAME_ARRAY, &shlibs, "shared library", "FILE" },
{ "debug", 0, 0, G_OPTION_ARG_NONE, &debug, "show debug messages", NULL },
{ "verbose", 0, 0, G_OPTION_ARG_NONE, &verbose, "show verbose messages", 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 },
{ NULL, }
};
@ -174,6 +176,13 @@ main (int argc, char ** argv)
g_log_set_default_handler (log_handler, NULL);
if (show_version)
{
g_printf ("g-ir-compiler %u.%u.%u\n",
GI_MAJOR_VERSION, GI_MINOR_VERSION, GI_MICRO_VERSION);
return 0;
}
if (!input)
{
g_fprintf (stderr, "no input files\n");