Subject: [PATCH 08/13] url-parse: define usage and options

From: "Matheus Afonso Martins Moreira via GitGitGadget" <[email-masked]>
Date: Sun, 28 Apr 2024 22:30:56 +0000

From: Matheus Afonso Martins Moreira <[email-masked]>

Create the data structures expected by the git option parser.

Signed-off-by: Matheus Afonso Martins Moreira <[email-masked]>
---
 builtin/url-parse.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/builtin/url-parse.c b/builtin/url-parse.c
index 15923460a78..c6095b37ede 100644
--- a/builtin/url-parse.c
+++ b/builtin/url-parse.c
@@ -11,8 +11,22 @@
 
 #include "builtin.h"
 #include "gettext.h"
+#include "parse-options.h"
 #include "urlmatch.h"
 
+static const char * const builtin_url_parse_usage[] = {
+	N_("git url-parse [<options>] [--] <url>..."),
+	NULL
+};
+
+static char *component_arg = NULL;
+
+static struct option builtin_url_parse_options[] = {
+	OPT_STRING('c', "component", &component_arg, "<component>", \
+		N_("which URL component to extract")),
+	OPT_END(),
+};
+
 enum url_component {
 	URL_NONE = 0,
 	URL_PROTOCOL,
-- 
gitgitgadget