From aaabf9edeb2712ce8401ac60b72c07f8f271f8b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Fri, 26 Jul 2024 22:59:39 +0200 Subject: [PATCH] refactor: remove OPTION_WITH_ARG --- src/cli/cli.h | 10 ++-------- src/cli/command/push.c | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/cli/cli.h b/src/cli/cli.h index 273fd15..e02e56b 100644 --- a/src/cli/cli.h +++ b/src/cli/cli.h @@ -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; \ } diff --git a/src/cli/command/push.c b/src/cli/command/push.c index 77103cf..bc86396 100644 --- a/src/cli/command/push.c +++ b/src/cli/command/push.c @@ -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();