refactor: remove OPTION_WITH_ARG

This commit is contained in:
Jozef Steinhübl 2024-07-26 22:59:39 +02:00
parent f61fa52851
commit aaabf9edeb
No known key found for this signature in database
GPG key ID: E6BC90C91973B08F
2 changed files with 4 additions and 10 deletions

View file

@ -13,15 +13,9 @@
argc -= optind; \
argv += optind;
#define OPTION(opt, func) \
#define OPTION(opt, func, ...) \
case opt: { \
func(); \
break; \
}
#define OPTION_WITH_ARG(opt, func, arg) \
case opt: { \
func(arg); \
func(__VA_ARGS__); \
break; \
}

View file

@ -80,8 +80,8 @@ int cli_command_push(int argc, char **argv) {
bool verbose = false;
HANDLE_OPTIONS(argc, argv, "tv",
OPTION_WITH_ARG('t', set_tags, &tags)
OPTION_WITH_ARG('v', set_verbose, &verbose));
OPTION('t', set_tags, &tags)
OPTION('v', set_verbose, &verbose));
char *branch_name = get_current_branch_name();