summaryrefslogtreecommitdiffstats
path: root/src/cli/common.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 05:03:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 05:03:04 +0000
commitb88736462df2c86a83f01dcc260b5463205819d2 (patch)
treeb1a9a5a5392a52ec4e5f60fb4b45083cf7fd65b0 /src/cli/common.h
parentAdding upstream version 1.7.2+ds. (diff)
downloadlibgit2-upstream.tar.xz
libgit2-upstream.zip
Adding upstream version 1.8.1+ds.upstream/1.8.1+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cli/common.h')
-rw-r--r--src/cli/common.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/cli/common.h b/src/cli/common.h
new file mode 100644
index 0000000..3aed8ad
--- /dev/null
+++ b/src/cli/common.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) the libgit2 contributors. All rights reserved.
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+
+#ifndef CLI_common_h__
+#define CLI_common_h__
+
+#define PROGRAM_NAME "git2"
+
+#include "git2_util.h"
+
+#include "error.h"
+#include "opt.h"
+#include "opt_usage.h"
+
+/*
+ * Common command arguments.
+ */
+
+#define CLI_COMMON_OPT_HELP \
+ CLI_OPT_TYPE_SWITCH, "help", 0, &show_help, 1, \
+ CLI_OPT_USAGE_HIDDEN | CLI_OPT_USAGE_STOP_PARSING
+#define CLI_COMMON_OPT_CONFIG \
+ CLI_OPT_TYPE_VALUE, NULL, 'c', NULL, 0, \
+ CLI_OPT_USAGE_HIDDEN
+#define CLI_COMMON_OPT_CONFIG_ENV \
+ CLI_OPT_TYPE_VALUE, "config-env", 0, NULL, 0, \
+ CLI_OPT_USAGE_HIDDEN
+
+#define CLI_COMMON_OPT \
+ { CLI_COMMON_OPT_HELP }, \
+ { CLI_COMMON_OPT_CONFIG }, \
+ { CLI_COMMON_OPT_CONFIG_ENV }
+
+typedef struct {
+ char **args;
+ int args_len;
+} cli_repository_open_options;
+
+extern int cli_repository_open(
+ git_repository **out,
+ cli_repository_open_options *opts);
+
+/*
+ * Common command arguments.
+ */
+
+#define CLI_COMMON_OPT_HELP \
+ CLI_OPT_TYPE_SWITCH, "help", 0, &show_help, 1, \
+ CLI_OPT_USAGE_HIDDEN | CLI_OPT_USAGE_STOP_PARSING
+#define CLI_COMMON_OPT_CONFIG \
+ CLI_OPT_TYPE_VALUE, NULL, 'c', NULL, 0, \
+ CLI_OPT_USAGE_HIDDEN
+#define CLI_COMMON_OPT_CONFIG_ENV \
+ CLI_OPT_TYPE_VALUE, "config-env", 0, NULL, 0, \
+ CLI_OPT_USAGE_HIDDEN
+
+#define CLI_COMMON_OPT \
+ { CLI_COMMON_OPT_HELP }, \
+ { CLI_COMMON_OPT_CONFIG }, \
+ { CLI_COMMON_OPT_CONFIG_ENV }
+
+#endif /* CLI_common_h__ */