t / helper / test-tool.con commit rebase-interactive.c: remove the_repository references (36e7ed6)
   1#include "git-compat-util.h"
   2#include "test-tool.h"
   3
   4struct test_cmd {
   5        const char *name;
   6        int (*fn)(int argc, const char **argv);
   7};
   8
   9static struct test_cmd cmds[] = {
  10        { "chmtime", cmd__chmtime },
  11        { "config", cmd__config },
  12        { "ctype", cmd__ctype },
  13        { "date", cmd__date },
  14        { "delta", cmd__delta },
  15        { "drop-caches", cmd__drop_caches },
  16        { "dump-cache-tree", cmd__dump_cache_tree },
  17        { "dump-fsmonitor", cmd__dump_fsmonitor },
  18        { "dump-split-index", cmd__dump_split_index },
  19        { "dump-untracked-cache", cmd__dump_untracked_cache },
  20        { "example-decorate", cmd__example_decorate },
  21        { "genrandom", cmd__genrandom },
  22        { "hashmap", cmd__hashmap },
  23        { "index-version", cmd__index_version },
  24        { "json-writer", cmd__json_writer },
  25        { "lazy-init-name-hash", cmd__lazy_init_name_hash },
  26        { "match-trees", cmd__match_trees },
  27        { "mergesort", cmd__mergesort },
  28        { "mktemp", cmd__mktemp },
  29        { "online-cpus", cmd__online_cpus },
  30        { "parse-options", cmd__parse_options },
  31        { "path-utils", cmd__path_utils },
  32        { "pkt-line", cmd__pkt_line },
  33        { "prio-queue", cmd__prio_queue },
  34        { "reach", cmd__reach },
  35        { "read-cache", cmd__read_cache },
  36        { "read-midx", cmd__read_midx },
  37        { "ref-store", cmd__ref_store },
  38        { "regex", cmd__regex },
  39        { "repository", cmd__repository },
  40        { "revision-walking", cmd__revision_walking },
  41        { "run-command", cmd__run_command },
  42        { "scrap-cache-tree", cmd__scrap_cache_tree },
  43        { "sha1", cmd__sha1 },
  44        { "sha1-array", cmd__sha1_array },
  45        { "sigchain", cmd__sigchain },
  46        { "strcmp-offset", cmd__strcmp_offset },
  47        { "string-list", cmd__string_list },
  48        { "submodule-config", cmd__submodule_config },
  49        { "subprocess", cmd__subprocess },
  50        { "urlmatch-normalization", cmd__urlmatch_normalization },
  51        { "wildmatch", cmd__wildmatch },
  52#ifdef GIT_WINDOWS_NATIVE
  53        { "windows-named-pipe", cmd__windows_named_pipe },
  54#endif
  55        { "write-cache", cmd__write_cache },
  56};
  57
  58static 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
  68int cmd_main(int argc, const char **argv)
  69{
  70        int i;
  71
  72        BUG_exit_code = 99;
  73        if (argc < 2)
  74                die_usage();
  75
  76        for (i = 0; i < ARRAY_SIZE(cmds); i++) {
  77                if (!strcmp(cmds[i].name, argv[1])) {
  78                        argv++;
  79                        argc--;
  80                        return cmds[i].fn(argc, argv);
  81                }
  82        }
  83        error("there is no tool named '%s'", argv[1]);
  84        die_usage();
  85}