ghorg
CLI application to get information about organization on GitHub., (*1)
, (*2)
Install
git clone git@github.com:gedex/ghorg.git
cd ghorg
composer install
You can run ./ghorg from current directory., (*3)
If you want to build the phar file:, (*4)
box build
and you can move the file to your OS PATH:, (*5)
mv ghorg.phar /usr/local/bin/ghorg
Now you can run ghorg from anywhere., (*6)
, (*7)
Configuration
The first time you need to do is configure your ghorg, especially method_auth
if you want to use GitHub token, client_id/client_secret, or username/password.
If method_auth and related auth config keys are left empty then client will
make unathenticated requests. See GitHub API for more detail., (*8)
The easiest way to authenticate is by using personal token which can be created
from https://github.com/settings/tokens. You can then set the token with:, (*9)
ghorg config token YOUR_PERSONAL_TOKEN
ghorg config method_auth token
Verify whether your config is saved with:, (*10)
ghorg config
, (*11)
Usage
members:list
To list members who are members of an organization:, (*12)
ghorg members:list FriendsOfPHP
this will output:, (*13)
+---------+------------+------+------------+
| id | login | type | site_admin |
+---------+------------+------+------------+
| 47313 | fabpot | User | false |
| 946104 | Hywan | User | false |
| 327237 | jubianchi | User | false |
| 2716794 | keradus | User | false |
| 408368 | lyrixx | User | false |
| 282408 | pierrejoye | User | false |
| 540268 | tarekdj | User | false |
+---------+------------+------+------------+
You can pass option -f <fields> or --fields=<fields> to display custom fields.
For example:, (*14)
ghorg members:list -f 'login,html_url'
See https://developer.github.com/v3/orgs/members/#response for list of available
fields. If you're wondering how to get member's followers or public_repos,
like in https://developer.github.com/v3/users/#get-a-single-user, then you need
to pass option -d or --detail in which it will request member info. It will
take time for organization with thousands of members., (*15)
Here's an example that show top 5 members based on number of followers from golang:, (*16)
ghorg members:list golang --detail --fields='login,html_url,followers' --orderby=followers --limit=5
+----------+-----------------------------+-----------+
| login | html_url | followers |
+----------+-----------------------------+-----------+
| bradfitz | https://github.com/bradfitz | 2839 |
| rakyll | https://github.com/rakyll | 1697 |
| campoy | https://github.com/campoy | 457 |
| dsymonds | https://github.com/dsymonds | 286 |
| dvyukov | https://github.com/dvyukov | 269 |
+----------+-----------------------------+-----------+
You can also filter returned rows with option -F <query_string> or --filter=<query_string>.
For example to list members of an <org> within San Francisco and hireable:, (*17)
ghorg members:list <org> --detail --fields='login,name,location' -F 'location=San Francisco&hireable=true'
Filter uses query string format and there are some comparison operators you can
pass., (*18)
'==', '===', '!=', '!==', '>', '<', '>=', '<=', '~'
Tilde, ~, is like MySQL's LIKE statement. For example to filter login that
like john:, (*19)
ghorg members:list <org> -F 'login[operator]=~&login[value]=john'
repos:list
Command repos:list have similar options like members:list, except --detail
is not applied. Here's a simple example to list repositories of an organization:, (*20)
ghorg repos:list <org>
License
ghorg is licensed under the MIT License - see the LICENSE file for details., (*21)