gh-cli-rs
🦀 A Rust wrapper for the GitHub CLI with a type-safe, fluent API. Built with Command Pattern, Fluent Interface, and Builder Pattern.
The library is ideal for building gh extensions and automating GitHub workflows in Rust.
There are tons of commands in https://cli.github.com/manual/gh not implemented yet. PRs welcome!
I plan to add support for all the core commands in the near future.
Requirements
- GitHub CLI installed and authenticated
- Rust 1.56+
&&
Installation
[]
= "0.1.0"
Quick Start
use GhClient;
Usage
Repositories
client.repo.list.limit.execute?;
client.repo.view.execute?;
client.repo.create.public.description.execute?;
client.repo.clone.execute?;
Pull Requests
client.pr.list.state.limit.execute?;
client.pr.create.title.body.base.execute?;
client.pr.view.execute?;
client.pr.checkout.execute?;
client.pr.merge.squash.execute?;
Note: To create a PR, be on a feature branch with commits pushed to remote.
Issues
client.issue.list.state.execute?;
client.issue.create.title.body.execute?;
client.issue.view.execute?;
client.issue.close.execute?;
Auth & Releases
// Auth
client.auth.status.execute?;
client.auth.login.execute?;
client.auth.logout.execute?;
// Releases
client.release.list.limit.execute?;
client.release.create.title.notes.execute?;
client.release.view.execute?;
Error Handling
use GhError;
match client.repo.view.execute
Custom gh Path
let client = builder.gh_path.build;
Examples
License
MIT OR Apache-2.0