better vips error msg

"vips mpouikh" makes a better error message
This commit is contained in:
John Cupitt 2011-06-06 12:31:12 +01:00
parent 20a65cca59
commit 7b6bc4267b
2 changed files with 23 additions and 16 deletions

8
TODO
View File

@ -1,16 +1,10 @@
- try
vips wegkfljwrlkgj
no error msg
- revisit orc conv - revisit orc conv
use an 8.8 accumulator ... build the scale into the 8.8 coeffs ... no div at use an 8.8 accumulator ... build the scale into the 8.8 coeffs ... no div at
the end, just a shift the end, just a shift
need 8.8 x 8.8 -> 8.8 for each coeff though need 8 x 8.8 -> 8.8 for each coeff though

View File

@ -902,6 +902,7 @@ typedef int (*Action)( int argc, char **argv );
typedef struct _ActionEntry { typedef struct _ActionEntry {
char *name; char *name;
char *description;
GOptionEntry *group; GOptionEntry *group;
Action action; Action action;
} ActionEntry; } ActionEntry;
@ -911,10 +912,14 @@ static GOptionEntry empty_options[] = {
}; };
static ActionEntry actions[] = { static ActionEntry actions[] = {
{ "cpph", &empty_options[0], print_cppdecls }, { "list", N_( "list classes|packages|all|package-name|operation-name" ),
{ "cppc", &empty_options[0], print_cppdefs }, &empty_options[0], print_list },
{ "links", &empty_options[0], print_links }, { "cpph", N_( "generate headers for C++ binding" ),
{ "list", &empty_options[0], print_list } &empty_options[0], print_cppdecls },
{ "cppc", N_( "generate bodies for C++ binding" ),
&empty_options[0], print_cppdefs },
{ "links", N_( "generate links for vips/bin" ),
&empty_options[0], print_links },
}; };
static void static void
@ -1061,7 +1066,8 @@ main( int argc, char **argv )
/* Could be a vips7 im_function. /* Could be a vips7 im_function.
*/ */
if( action && !handled && (fn = im_find_function( action )) ) { if( action && !handled &&
(fn = im_find_function( action )) ) {
(void) add_main_group( context, NULL ); (void) add_main_group( context, NULL );
parse_options( context, &argc, argv ); parse_options( context, &argc, argv );
@ -1078,7 +1084,8 @@ main( int argc, char **argv )
/* Could be a vips8 VipsOperation. /* Could be a vips8 VipsOperation.
*/ */
if( action && !handled && (operation = vips_operation_new( action )) ) { if( action && !handled &&
(operation = vips_operation_new( action )) ) {
main_group = add_main_group( context, operation ); main_group = add_main_group( context, operation );
vips_call_options( main_group, operation ); vips_call_options( main_group, operation );
parse_options( context, &argc, argv ); parse_options( context, &argc, argv );
@ -1103,12 +1110,18 @@ main( int argc, char **argv )
} }
im_error_clear(); im_error_clear();
if( action && !handled ) {
printf( "%s", _( "possible actions:\n" ) );
for( i = 0; i < VIPS_NUMBER( actions ); i++ )
printf( "%10s - %s\n",
actions[i].name, actions[i].description );
error_exit( "unknown action \"%s\"", action );
}
if( !handled ) { if( !handled ) {
(void) add_main_group( context, NULL ); (void) add_main_group( context, NULL );
parse_options( context, &argc, argv ); parse_options( context, &argc, argv );
if( argc > 1 )
error_exit( "unknown argument %s\n", argv[1] );
} }
g_option_context_free( context ); g_option_context_free( context );