add --vips-version cmdline arg

print version of libvips that a program is running against
This commit is contained in:
John Cupitt 2012-07-20 13:34:05 +01:00
parent a71fe51d2d
commit 7df7bb85bb
3 changed files with 35 additions and 13 deletions

View File

@ -1,5 +1,6 @@
20/7/12 started 7.30.0
- support "rs" mode in vips7
- add --vips-version cmdline arg
19/3/12 started 7.29.0
- sanity-check PNG read geometry

View File

@ -365,20 +365,29 @@ vips__ngettext( const char *msgid, const char *plural, unsigned long int n )
return( dngettext( GETTEXT_PACKAGE, msgid, plural, n ) );
}
static gboolean
vips_lib_version_cb( const gchar *option_name, const gchar *value,
gpointer data, GError **error )
{
printf( "libvips %s\n", VIPS_VERSION_STRING );
vips_shutdown();
exit( 0 );
}
static GOptionEntry option_entries[] = {
{ "vips-concurrency", 'c', 0,
G_OPTION_ARG_INT, &vips__concurrency,
N_( "evaluate with N concurrent threads" ), "N" },
{ "vips-tile-width", 'w', 0,
{ "vips-tile-width", 'w', G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_INT, &vips__tile_width,
N_( "set tile width to N (DEBUG)" ), "N" },
{ "vips-tile-height", 'h', 0,
{ "vips-tile-height", 'h', G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_INT, &vips__tile_height,
N_( "set tile height to N (DEBUG)" ), "N" },
{ "vips-thinstrip-height", 't', 0,
{ "vips-thinstrip-height", 't', G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_INT, &vips__thinstrip_height,
N_( "set thinstrip height to N (DEBUG)" ), "N" },
{ "vips-fatstrip-height", 'f', 0,
{ "vips-fatstrip-height", 'f', G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_INT, &vips__fatstrip_height,
N_( "set fatstrip height to N (DEBUG)" ), "N" },
{ "vips-progress", 'p', 0,
@ -408,6 +417,9 @@ static GOptionEntry option_entries[] = {
{ "vips-cache-dump", 'r', 0,
G_OPTION_ARG_NONE, &vips__cache_dump,
N_( "dump operation cache on exit" ), NULL },
{ "vips-version", 'v', G_OPTION_FLAG_NO_ARG,
G_OPTION_ARG_CALLBACK, (gpointer) &vips_lib_version_cb,
N_( "print libvips version" ), NULL },
{ NULL }
};

View File

@ -57,28 +57,37 @@ static gboolean nodelete_profile = FALSE;
static gboolean verbose = FALSE;
static GOptionEntry options[] = {
{ "size", 's', 0, G_OPTION_ARG_INT, &thumbnail_size,
{ "size", 's', 0,
G_OPTION_ARG_INT, &thumbnail_size,
N_( "set thumbnail size to SIZE" ),
N_( "SIZE" ) },
{ "output", 'o', 0, G_OPTION_ARG_STRING, &output_format,
{ "output", 'o', 0,
G_OPTION_ARG_STRING, &output_format,
N_( "set output to FORMAT" ),
N_( "FORMAT" ) },
{ "interpolator", 'p', 0, G_OPTION_ARG_STRING, &interpolator,
{ "interpolator", 'p', 0,
G_OPTION_ARG_STRING, &interpolator,
N_( "resample with INTERPOLATOR" ),
N_( "INTERPOLATOR" ) },
{ "nosharpen", 'n', 0, G_OPTION_ARG_NONE, &nosharpen,
{ "nosharpen", 'n', 0,
G_OPTION_ARG_NONE, &nosharpen,
N_( "don't sharpen thumbnail" ), NULL },
{ "eprofile", 'e', 0, G_OPTION_ARG_STRING, &export_profile,
{ "eprofile", 'e', 0,
G_OPTION_ARG_STRING, &export_profile,
N_( "export with PROFILE" ),
N_( "PROFILE" ) },
{ "iprofile", 'i', 0, G_OPTION_ARG_STRING, &import_profile,
{ "iprofile", 'i', 0,
G_OPTION_ARG_STRING, &import_profile,
N_( "import untagged images with PROFILE" ),
N_( "PROFILE" ) },
{ "delete", 'd', 0, G_OPTION_ARG_NONE, &delete_profile,
{ "delete", 'd', 0,
G_OPTION_ARG_NONE, &delete_profile,
N_( "delete profile from exported image" ), NULL },
{ "nodelete", 'l', 0, G_OPTION_ARG_NONE, &nodelete_profile,
{ "nodelete", 'l', G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_NONE, &nodelete_profile,
N_( "(deprecated, does nothing)" ), NULL },
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
{ "verbose", 'v', 0,
G_OPTION_ARG_NONE, &verbose,
N_( "verbose output" ), NULL },
{ NULL }
};