summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-02-26 22:13:32 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-02-26 22:13:32 -0500
commit7b94703cd9ae5fc08a8167f30831c6b27fa9b186 (patch)
tree0f48b8161e1c61c3690475c5a04fe1a4c597dae7
parent1327dbcf2a4273a8ba6fd978db5f0882530af94d (diff)
downloadlibgit2-7b94703cd9ae5fc08a8167f30831c6b27fa9b186.tar.gz
cli: provide die macros for ease of exiting
-rw-r--r--src/cli/error.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cli/error.h b/src/cli/error.h
index cce7a54c0..bbc39134c 100644
--- a/src/cli/error.h
+++ b/src/cli/error.h
@@ -48,4 +48,11 @@ GIT_INLINE(int) cli_error_git(void)
#define cli_error_os() (perror(PROGRAM_NAME), CLI_EXIT_OS)
+#define cli_die(...) \
+ do { exit(cli_error(__VA_ARGS__)); } while(0)
+#define cli_die_git(...) \
+ do { exit(cli_error_git(__VA_ARGS__)); } while(0)
+#define cli_die_os(...) \
+ do { exit(cli_error_os(__VA_ARGS__)); } while(0)
+
#endif /* CLI_error_h__ */