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
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/hook.c')
-rw-r--r--builtin/hook.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/builtin/hook.c b/builtin/hook.c
index 54e5c6ec93..b6530d189a 100644
--- a/builtin/hook.c
+++ b/builtin/hook.c
@@ -67,18 +67,14 @@ usage:
int cmd_hook(int argc, const char **argv, const char *prefix)
{
+ parse_opt_subcommand_fn *fn = NULL;
struct option builtin_hook_options[] = {
+ OPT_SUBCOMMAND("run", &fn, run),
OPT_END(),
};
argc = parse_options(argc, argv, NULL, builtin_hook_options,
- builtin_hook_usage, PARSE_OPT_STOP_AT_NON_OPTION);
- if (!argc)
- goto usage;
+ builtin_hook_usage, 0);
- if (!strcmp(argv[0], "run"))
- return run(argc, argv, prefix);
-
-usage:
- usage_with_options(builtin_hook_usage, builtin_hook_options);
+ return fn(argc, argv, prefix);
}