lazygithub
lazygithub
is a simple CLI tool written in Go to keep track of your GitHub
gists, issues, pull requests and repositories using the
GitHub v3 REST API.
lazygithub
is providing the possibility to easily filter, order and grep
for patterns and will print the output nicely to your terminal.
The tool is work in progress. There will be still some bugs and missing
features, especially since the testing part needs more love. If you're cachting
something feel free to raise an issue or submit a pull request.
Install
You can use an
official release of
lazygithub
. The tarballs for each release contain the CLI application.
Copy the binary in your $PATH
or call it directly via
$YOURDIR/lazygithub
.
Of course you can also get the latest version using go get
.
go get github.com/timorunge/lazygithub/cmd/lazygithub
If $GOPATH/bin
is not in your $PATH
call lazygithub
directly via
$GOPATH/bin/lazygithub
.
Last but not least you also have the possibility to to clone this repository
and use mage to test
, build
and install
lazygithub
.
Usage
lazygithub
will take the current directory as a base to determinate the
scope. lazygithub
will identify if you are either working inside a repository,
organization or an user directory. To make this possible it's important that
the directory structure is corresponding with the GitHub structure:
github.com/(ORGANIZATION|USER)/REPOSITORY
Afterwards simply call lazygithub
to explore gists, issues, pull requests and
repositories.
To see the status of gists, issues, pull requests and repositories that you
created there is the my
command. lazygithub my
can be called anytime from
anywhere and is not depending on the directory structure.
Each command is providing informations about itself which can be accessed
with the --help
flag (e.g. lazygithub issues --help
).
Authentification
GitHub
lazygithub
is using the following environment variables:
GITHUB_TOKEN
GITHUB_USERNAME
GITHUB_PASSWORD
which will be used for the authentification against GitHub.
The GITHUB_TOKEN
has priority and will be used if present. If this is not the
case lazygithub
will try to authenticate with the GITHUB_USERNAME
and
GITHUB_PASSWORD
.
If those values are not set you will get prompted for your username and
password. An additional promt to enter your OTP token will show up if 2FA
is enabled.
It's highly recommended to use a token. You can find - in the GitHub help a
good documentation
of how to setup one.
Public information can be queried anonymously. To see private information your
token needs the following scopes:
- To see private repositories: repo
- To see private gists: gist
With the --anonymous
flag you can disable authentification entirely. Keep
in mind that without authentification the rate limit from the GitHub API is
limited to 60 requests per hour while the quota for authentificated requests
is at 5000 per hour. For further details have a look at the
REST API documentation.
git
lazygithub
is using ssh
for cloning projects. Therefore it's required to
have an existing ssh
key which is added to your ssh-agent
and in GitHub.
A documentation
of how to connect GitHub via SSH can be found at the GitHub help center.
For the update
operation in the repos
command lazygithub
will use the
definition of the git repository and will use whatever is defined there. This
operation is always pulling from the remote origin
.
Example
~/git/github.com/aws
is the directory of my the cloned repositories from AWS.
In this directory I'm storing e.g. the aws-cli
.
That's how it's meant to be and will work perfectly fine. ~/git/aws
would
also work since the base will be set to aws
as well.
An example directory structure in ~/git/github.com
should look like the
following:
.
└── github.com
├── aws
│ └── aws-cli
└── weaveworks
├── eksctl
└── footloose
What won't work will be something like ~/git/aws-cli
because the base will bet
set to git
.
Since some repositories can become quite large limiting and filtering becomes
crucial. By default lazygithub
is limiting the amount of items to 50 which
can be modified using the --limit
flag. Ordering and sorting are depending on
the subcommands.
Using the --grep
flag can limit the results by specific needs. Using the flag
is not causing any search operation on the GitHub API so it's limited to the
results which lazygithub
is getting from the other filters.
lazygithub repos --grep cli
Will show all repositories in the current directory which are matching the
pattern cli
.
lazygithub issues --state all --limit 10
Will show the last 10 created issues for the current repository, no matter if
they are open or already closed.
lazygithub my pulls --state all --grep ansible
Will show all pull requests that the authenticated user has done, no matter if
they are open or already closed. Again the result will be limited by the
pattern ansible
.
As you can see it's an easy way to keep track without leaving the terminal.
Krudos
lazygithub
would not work without:
License
BSD 3-Clause "New" or "Revised" License