CLI-based access to GitHub API v3 that works hand-in-hand with github_api
gem.
Add this line to your application's Gemfile:
gem 'github_cli'
And then execute:
$ bundle
Or install it yourself as:
$ gem install github_cli
Run it:
$ gcli
The first step is to create a configuration file, either global in home directory or local inside the project:
$ gcli init [--global|--local]
This will setup a .githubrc
configuration file in your home/project directory
with all the global settings. During the install process you will be prompted
for your authentication token
.
Moreover, gcli config
command allows you to set/get any configuration option such as output format, editor or oauth token.
For instance, to check value for your token
do
$ gcli config [--global|--local] auth.token
and to set the value do
$ gcli config [--global|--local] auth.token lh23l4kj234....
To list specific options
$ gcli config [--global|--local] --list [regex]
The required arguments come first as per command description, then are followed by the optional arguments supplied inside a params
flag.
For instance, one can create repository by supplying parameters in the following way:
$ gcli repo create octokit --params=description:'Test repo for kitty.'
To create repository inside organization:
$ gcli repo create github/octokit --params=description:'Test repo for kitty.'
To find out which options are required and which are optional - type:
$ gcli repo help create
You can list all GitHub APIs comamnds:
$ gcli list
to limit returned results pass pattern
$ gcli list re* # Returns all commands matching the pattern
The API responses can be formatted as csv
, json
, pretty
, table
.
By default responses are in tabular format. Tables are available in horizontal
and vertical
mode. To enforce table display pass :h
and :v
respectively. Otherwise a default orientation will be picked depending on the request made and terminal size.
To get csv
formatting for easy command piping do
gcli repo ls -u wycats --format=csv
By default all responses are paged. You can switch off paging by supplying no-pager
flag.
gcli --no-pager user ls -u wycats
Also you can supply you preferred pager
, otherwise the paging program is taken from environment variable PAGER if defined or defaults to "less".
Interact with git data:
$ gcli blob
$ gcli commit
$ gcli ref
$ gcli tag
$ gcli tree
Interact with issues:
$ gcli issue
$ gcli label
$ gcli milestone
$ gcli comment
Interact with repositories:
$ gcli repo
$ gcli collab
$ gcli content
$ gcli download
$ gcli fork
$ gcli hook
$ gcli key
$ gcli watching
Interact with gists:
$ gcli gist
Interact with users:
$ gcli user
$ gcli email
$ gcli follower
Interact with organizations:
$ gcli org
$ gcli member
$ gcli team
Interact with authorizations:
$ gcli auth
Interact with search:
$ gcli search
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Copyright (c) 2012 Piotr Murach. See LICENSE for further details.