]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/helper/test-tool.c
Merge branch 'bc/sha-256'
[thirdparty/git.git] / t / helper / test-tool.c
index 2a65193514482b7b1278b7be5e1edae123a1b49e..5b137874e1d21166c92d00f540f6ecd68c18780a 100644 (file)
@@ -48,6 +48,7 @@ static struct test_cmd cmds[] = {
        { "strcmp-offset", cmd__strcmp_offset },
        { "string-list", cmd__string_list },
        { "submodule-config", cmd__submodule_config },
+       { "submodule-nested-repo-config", cmd__submodule_nested_repo_config },
        { "subprocess", cmd__subprocess },
        { "urlmatch-normalization", cmd__urlmatch_normalization },
        { "wildmatch", cmd__wildmatch },
@@ -57,13 +58,23 @@ static struct test_cmd cmds[] = {
        { "write-cache", cmd__write_cache },
 };
 
+static NORETURN void die_usage(void)
+{
+       size_t i;
+
+       fprintf(stderr, "usage: test-tool <toolname> [args]\n");
+       for (i = 0; i < ARRAY_SIZE(cmds); i++)
+               fprintf(stderr, "  %s\n", cmds[i].name);
+       exit(128);
+}
+
 int cmd_main(int argc, const char **argv)
 {
        int i;
 
        BUG_exit_code = 99;
        if (argc < 2)
-               die("I need a test name!");
+               die_usage();
 
        for (i = 0; i < ARRAY_SIZE(cmds); i++) {
                if (!strcmp(cmds[i].name, argv[1])) {
@@ -72,5 +83,6 @@ int cmd_main(int argc, const char **argv)
                        return cmds[i].fn(argc, argv);
                }
        }
-       die("There is no test named '%s'", argv[1]);
+       error("there is no tool named '%s'", argv[1]);
+       die_usage();
 }