diff mbox series

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

Message ID a2acfdbc76c29f59c24c8a8b25076bde121efdf3.1714343461.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series builtin: implement, document and test url-parse | expand

Commit Message

Matheus Afonso Martins Moreira April 28, 2024, 10:30 p.m. UTC
From: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>

Create the data structures expected by the git option parser.

Signed-off-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
---
 builtin/url-parse.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox series

Patch

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,