gedex/ghorg

用于获取GitHub上组织信息的命令行应用程序

维护者

详细信息

github.com/gedex/ghorg

源代码

问题

安装: 0

依赖: 0

建议者: 0

安全: 0

星标: 1

关注者: 1

分叉: 0

开放问题: 0

类型:应用程序

0.2.0 2017-01-04 04:39 UTC

This package is not auto-updated.

Last update: 2024-09-14 20:04:12 UTC


README

用于获取GitHub上组织信息的命令行应用程序。

安装

git clone git@github.com:gedex/ghorg.git
cd ghorg
composer install

您可以从当前目录运行./ghorg

如果您想构建phar文件

box build

并将其移动到您的操作系统PATH

mv ghorg.phar /usr/local/bin/ghorg

现在您可以从任何地方运行ghorg

配置

第一次运行时,您需要配置ghorg,特别是如果您想使用GitHub令牌、client_id/client_secret或用户名/密码,则必须配置method_auth。如果method_auth和相关认证配置键留空,则客户端将发出未经认证的请求。有关详细信息,请参阅GitHub API

最简单的认证方式是使用个人令牌,该令牌可以从https://github.com/settings/tokens创建。然后,您可以使用以下命令设置令牌:

ghorg config token YOUR_PERSONAL_TOKEN
ghorg config method_auth token

使用以下命令验证您的配置是否已保存

ghorg config

使用方法

members:list

列出组织中的成员

ghorg members:list FriendsOfPHP

这将输出

+---------+------------+------+------------+
| 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      |
+---------+------------+------+------------+

您可以使用选项-f <fields>--fields=<fields>来显示自定义字段。例如

ghorg members:list -f 'login,html_url'

有关可用字段的列表,请参阅https://developer.github.com/v3/orgs/members/#response。如果您想知道如何获取成员的followerspublic_repos,如https://developer.github.com/v3/users/#get-a-single-user中所示,则需要传递选项-d--detail,这将请求成员信息。对于有数千名成员的组织,这可能需要一些时间。

以下是一个示例,显示基于关注者数量排名前5的golang成员

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       |
+----------+-----------------------------+-----------+

您还可以使用选项-F <query_string>--filter=<query_string>过滤返回的行。例如,列出位于旧金山的<org>内的可雇佣成员

ghorg members:list <org> --detail --fields='login,name,location' -F 'location=San Francisco&hireable=true'

过滤器使用查询字符串格式,并提供一些可以传递的比较运算符。

'==', '===', '!=', '!==', '>', '<', '>=', '<=', '~'

波浪号~类似于MySQL的LIKE语句。例如,过滤出类似johnlogin

ghorg members:list <org> -F 'login[operator]=~&login[value]=john'

repos:list

命令repos:list具有与members:list类似的功能,但--detail选项不适用。以下是一个简单示例,用于列出组织的仓库

ghorg repos:list <org>

许可

ghorg遵循MIT许可证 - 请参阅LICENSE文件以获取详细信息。