mirror of
https://github.com/git-for-windows/git.git
synced 2026-03-31 12:16:11 -05:00
builtin/fsmonitor--daemon: use parse-options API fully
--help and -h are already handled internally so just parse_options() do the parsing and extract the command from the remaining options. as a side effect, avoid setting a variable argc to a value that was never used. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
This commit is contained in:
committed by
Victoria Dye
parent
cb65a5f918
commit
dc00bbbad4
@@ -20,20 +20,13 @@ int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix)
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
if (argc < 2)
|
||||
usage_with_options(builtin_fsmonitor__daemon_usage, options);
|
||||
|
||||
if (argc == 2 && !strcmp(argv[1], "-h"))
|
||||
usage_with_options(builtin_fsmonitor__daemon_usage, options);
|
||||
|
||||
git_config(git_default_config, NULL);
|
||||
|
||||
subcmd = argv[1];
|
||||
argv--;
|
||||
argc++;
|
||||
|
||||
argc = parse_options(argc, argv, prefix, options,
|
||||
builtin_fsmonitor__daemon_usage, 0);
|
||||
if (argc != 1)
|
||||
usage_with_options(builtin_fsmonitor__daemon_usage, options);
|
||||
subcmd = argv[0];
|
||||
|
||||
die(_("Unhandled subcommand '%s'"), subcmd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user