Expand description
Parse & construct GitHub repository URLs & specifiers
ghrepo
extracts a GitHub repository’s owner & name from various GitHub
URL formats (or just from a string of the form OWNER/REPONAME
or
REPONAME
), and the resulting object provides properties for going in
reverse to determine the possible URLs. Also included is a struct for
performing a couple useful inspections on local Git repositories, including
determining the corresponding GitHub owner & repository name.
let repo = GHRepo::new("octocat", "repository")?;
assert_eq!(repo.owner(), "octocat");
assert_eq!(repo.name(), "repository");
assert_eq!(repo.to_string(), "octocat/repository");
assert_eq!(repo.html_url(), "https://github.com/octocat/repository");
let repo2 = GHRepo::from_str("octocat/repository")?;
assert_eq!(repo, repo2);
let repo3 = GHRepo::from_str("https://github.com/octocat/repository")?;
assert_eq!(repo, repo3);
Structs
Enums
Error returned when a
LocalRepo
method failsError returned when trying to construct a
GHRepo
with invalid arguments
or parse an invalid repository specConstants
Regular expression for a valid GitHub repository name.
Regular expression for a valid GitHub username or organization name.