File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -55,13 +55,23 @@ static struct test_cmd cmds[] = {
55
55
{ "write-cache" , cmd__write_cache },
56
56
};
57
57
58
+ static NORETURN void die_usage (void )
59
+ {
60
+ size_t i ;
61
+
62
+ fprintf (stderr , "usage: test-tool <toolname> [args]\n" );
63
+ for (i = 0 ; i < ARRAY_SIZE (cmds ); i ++ )
64
+ fprintf (stderr , " %s\n" , cmds [i ].name );
65
+ exit (128 );
66
+ }
67
+
58
68
int cmd_main (int argc , const char * * argv )
59
69
{
60
70
int i ;
61
71
62
72
BUG_exit_code = 99 ;
63
73
if (argc < 2 )
64
- die ( "I need a test name!" );
74
+ die_usage ( );
65
75
66
76
for (i = 0 ; i < ARRAY_SIZE (cmds ); i ++ ) {
67
77
if (!strcmp (cmds [i ].name , argv [1 ])) {
@@ -70,5 +80,6 @@ int cmd_main(int argc, const char **argv)
70
80
return cmds [i ].fn (argc , argv );
71
81
}
72
82
}
73
- die ("There is no test named '%s'" , argv [1 ]);
83
+ error ("there is no tool named '%s'" , argv [1 ]);
84
+ die_usage ();
74
85
}
You can’t perform that action at this time.
0 commit comments