Expand description
Parse Git repository URLs into a stable, documented Rust data structure.
GitUrl::parse supports the host-specific layouts currently covered by the
test suite and README: GitHub, Bitbucket, and Azure DevOps over SSH,
HTTP(S), and related URL schemes. Local Unix paths and relative Windows
paths are also supported.
Absolute Windows drive paths such as C:\repo.git and
file:///C:/repo.git are intentionally unsupported.
§Examples
use parse_git_url::{GitUrl, Scheme};
let parsed = GitUrl::parse("git@github.com:tjtelan/git-url-parse-rs.git")
.expect("example URL should parse");
assert_eq!(parsed.host.as_deref(), Some("github.com"));
assert_eq!(parsed.owner.as_deref(), Some("tjtelan"));
assert_eq!(parsed.name, "git-url-parse-rs");
assert_eq!(parsed.scheme, Scheme::Ssh);Structs§
- From
StrError - GitUrl
- GitUrl represents an input URL used by git hosting tools and repositories.
- Normalize
UrlError
Enums§
- From
StrError Kind - Normalize
UrlError Kind - Scheme
- Supported URI schemes for parsing
Functions§
- normalize_
url normalize_urltakes in url as&strand takes an opinionated approach to identifyssh://orfile://urls that require more information to be added so that they can be parsed more effectively byurl::Url::parse()