| Crates.io | ghrepo-cli |
| lib.rs | ghrepo-cli |
| version | 0.7.0 |
| created_at | 2025-01-02 16:43:42.760287+00 |
| updated_at | 2025-01-02 16:43:42.760287+00 |
| description | Show current GitHub repository |
| homepage | |
| repository | https://github.com/jwodder/ghrepo-rust |
| max_upload_size | |
| id | 1501690 |
| size | 31,227 |
GitHub | crates.io | Issues | Changelog
The ghrepo-cli package provides a ghrepo command for for getting the GitHub
repository associated with a local Git repository, optionally along with
various derived URLs for the repository like the REST v3 API URL.
In order to install the ghrepo command, you first need to have Rust and
Cargo installed. You can then build
the latest release of ghrepo-cli and install it in ~/.cargo/bin by running:
cargo install ghrepo-cli
ghrepo [<options>] [<dirpath>]
ghrepo retrieves the URL of the origin remote (or another remote specified
with the --remote option) of the Git repository located in <dirpath> (or
the current directory if no argument is given) and parses it to determine what
GitHub repository it points to. By default, the command just outputs the
GitHub repository "fullname" (a string of the form {owner}/{name}), but if
the -J or --json option is supplied, a JSON object is output instead,
containing fields for the repository owner, name, fullname, and individual
URLs, like so:
{
"owner": "jwodder",
"name": "ghrepo-rust",
"fullname": "jwodder/ghrepo-rust",
"api_url": "https://api.github.com/repos/jwodder/ghrepo-rust",
"clone_url": "https://github.com/jwodder/ghrepo-rust.git",
"git_url": "git://github.com/jwodder/ghrepo-rust.git",
"html_url": "https://github.com/jwodder/ghrepo-rust",
"ssh_url": "git@github.com:jwodder/ghrepo-rust.git"
}
-J, --json — Output JSON-r REMOTE, --remote REMOTE — Parse the GitHub URL from the given remote
[default: origin]