Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-10-30 09:43:44 +0300
committerJunio C Hamano <gitster@pobox.com>2018-10-30 09:43:44 +0300
commit11914675aac58770a879bff2dfd7b874adbbb4ff (patch)
treecd3f1c6e6e8ba828a5ed536da989d7e0b33f7665 /t
parent4b73fdae975b4a0c1d70666c7a170e08a60fdfa1 (diff)
parent4e26569d9870e61c95c6ce79c6d556358b9da433 (diff)
Merge branch 'jk/test-tool-help'
Developer support. * jk/test-tool-help: test-tool: show tool list on error
Diffstat (limited to 't')
-rw-r--r--t/helper/test-tool.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 6b5836dc1b..5df8b682aa 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -55,13 +55,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])) {
@@ -70,5 +80,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();
}