[PATCH 12/13] Documentation: describe the url-parse builtin
- From
Matheus Afonso Martins Moreira via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Apr 28, 2024, 22:31 UTC
- Message-ID
- <abda074aeef2ffb20d2156b5f24f47745b6f3134.1714343461.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1715.git.git.1714343461.gitgitgadget@gmail.com>
From: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
The new url-parse builtin validates git URLs and optionally extracts their components.
Signed-off-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com> --- Documentation/git-url-parse.txt | 59 +++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Documentation/git-url-parse.txt
diff --git a/Documentation/git-url-parse.txt b/Documentation/git-url-parse.txt new file mode 100644 index 00000000000..bfbbad6c033 --- /dev/null +++ b/Documentation/git-url-parse.txt @@ -0,0 +1,59 @@ +git-url-parse(1) +================ + +NAME +---- +git-url-parse - Parse and extract git URL components + +SYNOPSIS +-------- +[verse] +'git url-parse' [<options>] [--] <url>... + +DESCRIPTION +----------- + +Git supports many ways to specify URLs, some of them non-standard. +For example, git supports the scp style [user@]host:[path] format. +This command eases interoperability with git URLs by enabling the +parsing and extraction of the components of all git URLs. + +OPTIONS +------- + +-c <arg>:: +--component <arg>:: + Extract the `<arg>` component from the given git URLs. + `<arg>` can be one of: + `protocol`, `user`, `password`, `host`, `port`, `path`. + +EXAMPLES +-------- + +* Print the host name: ++ +------------ +$ git url-parse --component host https://example.com/user/repo +example.com +------------ + +* Print the path: ++ +------------ +$ git url-parse --component path https://example.com/user/repo +/usr/repo +$ git url-parse --component path example.com:~user/repo +~user/repo +$ git url-parse --component path example.com:user/repo +/user/repo +------------ + +* Validate URLs without outputting anything: ++ +------------ +$ git url-parse https://example.com/user/repo example.com:~user/repo +------------ + +GIT +--- +Part of the linkgit:git[1] suite
-- gitgitgadget