Git and git-host helper CLI tool written in Rust.
This project is a more-or-less port of the C# git-gears-cs to Rust.
Git Gears tries to bridge the gap between a local git repository and remote git hosting services by bringing service functionality straight to the command line.
git-gears is written in Rust and compiled into a native executable.
So far, git-gears uses:
Since both GitHub and GitLab expose a GraphQL interface, git-gears uses the latter, instead of multiplying the dependencies on hosting service specific libraries.
However, at the time of writing this, not all functionality exposed via the respective GraphQL APIs seems to be correctly implemented. To bridge this gap, git-gears falls back on the REST API.
In the long run, this will also allow git-gears to interface with other git hosting services that expose only a REST API.
git-gears is built and named after my personal proof-of-concept
Python script git-cogs.
The image is still that about dented wheels interacting
in a smooth mechanical system.
- started project.
- git integration with libgit2 works, config can be read.
- GitHub proof-of-concept GraphQL connection works
- GitLab proof-of-concept GraphQL connection works
- GitHub
get-andlist-actions work. - GitLab
get-andlist-actions work, but slightly different from their GitHub counterparts. create-issueworks for GitHub and GitLabcreate-pullrequestworks for GitHub and GitLab, although limited to a single repository. (I.e. cross-repo-PRs (e.g. fork to upstream) are not supported yet).create-gistworks for GitHub and GitLab. GitLab has the option to add snippets to repos as well.create-repoworks for GitHub and GitLab, for the user's own namespace and optionally for organizations as well. YMMV depending on your token scope. (TODO: document which scope is required per feature).
- GitHub support
- GitLab support
- atm, support for other hosting services is not planned. I take pull requests (e.g. for BitBucket, Gogs etc).
- pull requests:
git gears create-pullrequestgit gears close-pullrequestgit gears get-pullrequestgit gears list-pullrequestsgit gears comment-pullrequestgit gears merge-pullrequest
- issues:
git gears create-issuegit gears close-issuegit gears get-issuegit gears list-issuesgit gears comment-issue
- gists:
git gears create-gistgit gears remove-gistgit gears get-gistgit gears list-gistsgit gears comment-gist
- repos:
git gears create-repogit gears delete-repogit gears get-repogit gears list-reposgit gears fork-repo
--browseroption:- open in browser?
- or open a local small browser window?
- or Shell-browser (Lynx)?
- displaying issue/pr/gist discussions in the shell.
git-gears requires a few settings to be added to your git-config, and allows to have different settings per project. (The configuration is read in order from local -> global -> system).
- Section
[gears "my.host"]:my.hostcorresponds to your git service hostname, e.g. github.com. - token: this is your private access token generated by the service.
- api: the API type to use, either 'github' or 'gitlab' (atm)
- url: the service's GraphQL endpoint URL.
- rest: the service's REST endpoint root URL.
In general, this looks like that:
[gears "my.host"]
token = <your access token>
api = <github|gitlab>
url = https://my.host/api/graphql
rest = https://my.host/apiAnd a more concrete use-case are the following settings:
[gears "github.com"]
token = <your github access token>
api = github
url = https://api.github.com/graphql
rest = https://api.github.com
[gears "github.enterprise.org"]
token = <your github enterprise access token>
api = github
url = https://github.enterprise.org/api/graphql
rest = https://github.enterprise.org/api
[gears "gitlab.com"]
token = <your gitlab access token>
api = gitlab
url = https://gitlab.com/api/graphql
rest = https://gitlab.com/api/v4For more details on the technical considerations of this project, please read my blog post