From: Matheus Afonso Martins Moreira via GitGitGadget Date: Sun, 28 Apr 2024 22:31:00 GMT Subject: [PATCH 12/13] Documentation: describe the url-parse builtin Message-ID: In-Reply-To: From: Matheus Afonso Martins Moreira The new url-parse builtin validates git URLs and optionally extracts their components. Signed-off-by: Matheus Afonso Martins Moreira --- 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' [] [--] ... + +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 :: +--component :: + Extract the `` component from the given git URLs. + `` 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