GitHub | crates.io | Documentation | Issues | Changelog
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.
Example
use Error;
use FromStr;
use GHRepo;
Command
ghrepo
also provides a command of the same name for getting the GitHub
repository associated with a local Git repository. To install this command on
your system, run:
cargo install ghrepo
Usage
ghrepo [<options>] [<dirpath>]
By default, the ghrepo
command just outputs the repository "fullname" (a
string of the form {owner}/{name}
). If the -J
or --json
option is
supplied, a JSON object is instead output, containing fields for the repository
owner, name, fullname, and individual URLs, like so:
Options
-J
,--json
— Output JSON-r REMOTE
,--remote REMOTE
— Parse the GitHub URL from the given remote [default:origin
]