github_cli 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +11 -11
- data/README.md +7 -0
- data/lib/github_cli.rb +1 -0
- data/lib/github_cli/apis.rb +2 -0
- data/lib/github_cli/apis/email.rb +28 -0
- data/lib/github_cli/apis/event.rb +58 -0
- data/lib/github_cli/apis/milestone.rb +40 -0
- data/lib/github_cli/cli.rb +0 -1
- data/lib/github_cli/command.rb +9 -3
- data/lib/github_cli/commands.rb +3 -0
- data/lib/github_cli/commands/emails.rb +36 -0
- data/lib/github_cli/commands/events.rb +88 -0
- data/lib/github_cli/commands/milestones.rb +67 -0
- data/lib/github_cli/config.rb +1 -1
- data/lib/github_cli/subcommands.rb +9 -0
- data/lib/github_cli/terminal.rb +11 -1
- data/lib/github_cli/thor_ext.rb +33 -0
- data/lib/github_cli/version.rb +1 -1
- data/spec/github_cli/config_spec.rb +13 -8
- data/spec/github_cli/helpers_spec.rb +2 -1
- metadata +19 -12
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
github_cli (0.3.
|
|
4
|
+
github_cli (0.3.1)
|
|
5
5
|
github_api (~> 0.5)
|
|
6
6
|
thor
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
addressable (2.2.7)
|
|
12
11
|
aruba (0.4.11)
|
|
13
12
|
childprocess (>= 0.2.3)
|
|
14
13
|
cucumber (>= 1.1.1)
|
|
@@ -24,27 +23,28 @@ GEM
|
|
|
24
23
|
json (>= 1.4.6)
|
|
25
24
|
term-ansicolor (>= 1.0.6)
|
|
26
25
|
diff-lcs (1.1.3)
|
|
27
|
-
faraday (0.
|
|
28
|
-
addressable (~> 2.2)
|
|
26
|
+
faraday (0.8.0)
|
|
29
27
|
multipart-post (~> 1.1)
|
|
30
|
-
rack (~> 1.1)
|
|
31
28
|
ffi (1.0.11)
|
|
32
29
|
gherkin (2.9.0)
|
|
33
30
|
json (>= 1.4.6)
|
|
34
|
-
github_api (0.5.
|
|
35
|
-
faraday (~> 0.
|
|
31
|
+
github_api (0.5.2)
|
|
32
|
+
faraday (~> 0.8.0)
|
|
36
33
|
hashie (~> 1.2.0)
|
|
37
34
|
multi_json (~> 1.3)
|
|
38
35
|
nokogiri (~> 1.5.2)
|
|
39
|
-
oauth2 (~> 0.
|
|
36
|
+
oauth2 (~> 0.7)
|
|
40
37
|
hashie (1.2.0)
|
|
38
|
+
httpauth (0.1)
|
|
41
39
|
json (1.6.5)
|
|
42
40
|
multi_json (1.3.2)
|
|
43
41
|
multipart-post (1.1.5)
|
|
44
42
|
nokogiri (1.5.2)
|
|
45
|
-
oauth2 (0.
|
|
46
|
-
faraday (~> 0.
|
|
43
|
+
oauth2 (0.7.1)
|
|
44
|
+
faraday (~> 0.8)
|
|
45
|
+
httpauth (~> 0.1)
|
|
47
46
|
multi_json (~> 1.0)
|
|
47
|
+
rack (~> 1.4)
|
|
48
48
|
rack (1.4.1)
|
|
49
49
|
rake (0.9.2.2)
|
|
50
50
|
rspec (2.8.0)
|
|
@@ -56,7 +56,7 @@ GEM
|
|
|
56
56
|
diff-lcs (~> 1.1.2)
|
|
57
57
|
rspec-mocks (2.8.0)
|
|
58
58
|
term-ansicolor (1.0.7)
|
|
59
|
-
thor (0.
|
|
59
|
+
thor (0.15.2)
|
|
60
60
|
|
|
61
61
|
PLATFORMS
|
|
62
62
|
ruby
|
data/README.md
CHANGED
data/lib/github_cli.rb
CHANGED
data/lib/github_cli/apis.rb
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module GithubCLI
|
|
4
|
+
class Email < API
|
|
5
|
+
|
|
6
|
+
class << self
|
|
7
|
+
|
|
8
|
+
def all(params, format)
|
|
9
|
+
output format do
|
|
10
|
+
github_api.users.emails.list params
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def add(emails, params, format)
|
|
15
|
+
output format do
|
|
16
|
+
github_api.users.emails.add emails, params
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def delete(emails, params, format)
|
|
21
|
+
output format do
|
|
22
|
+
github_api.users.emails.delete emails, params
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end # Email
|
|
28
|
+
end # GithubCLI
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module GithubCLI
|
|
4
|
+
class Event < API
|
|
5
|
+
|
|
6
|
+
class << self
|
|
7
|
+
|
|
8
|
+
def public(params, format)
|
|
9
|
+
output format do
|
|
10
|
+
github_api.events.public params
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def repository(user, repo, params, format)
|
|
15
|
+
output format do
|
|
16
|
+
github_api.events.repository user, repo, params
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def issue(user, repo, params, format)
|
|
21
|
+
output format do
|
|
22
|
+
github_api.events.issue user, repo, params
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def network(user, repo, params, format)
|
|
27
|
+
output format do
|
|
28
|
+
github_api.events.network user, repo, params
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def organization(org, params, format)
|
|
33
|
+
output format do
|
|
34
|
+
github_api.events.organization org, params
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def received(user, params, format)
|
|
39
|
+
output format do
|
|
40
|
+
github_api.events.received user, params
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def performed(user, params, format)
|
|
45
|
+
output format do
|
|
46
|
+
github_api.events.performed user, params
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def user_org(user, org, params, format)
|
|
51
|
+
output format do
|
|
52
|
+
github_api.events.user_org user, org, params
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end # Event
|
|
58
|
+
end # GithubCLI
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module GithubCLI
|
|
4
|
+
class Milestone < API
|
|
5
|
+
|
|
6
|
+
class << self
|
|
7
|
+
|
|
8
|
+
def all(user, repo, params, format)
|
|
9
|
+
output format do
|
|
10
|
+
github_api.issues.milestones.list user, repo, params
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def get(user, repo, id, params, format)
|
|
15
|
+
output format do
|
|
16
|
+
github_api.issues.milestones.get user, repo, id, params
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def create(user, repo, params, format)
|
|
21
|
+
output format do
|
|
22
|
+
github_api.issues.milestones.create user, repo, params
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def update(user, repo, id, params, format)
|
|
27
|
+
output format do
|
|
28
|
+
github_api.issues.milestones.update user, repo, id, params
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def delete(user, repo, id, params, format)
|
|
33
|
+
output format do
|
|
34
|
+
github_api.issues.milestones.delete user, repo, id, params
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end # Milestone
|
|
40
|
+
end # GithubCLI
|
data/lib/github_cli/cli.rb
CHANGED
|
@@ -30,7 +30,6 @@ module GithubCLI
|
|
|
30
30
|
class_option :verbose, :type => :boolean,
|
|
31
31
|
:banner => "Enable verbose output mode."
|
|
32
32
|
|
|
33
|
-
|
|
34
33
|
desc 'init', 'Generates a configuration file in your home directory'
|
|
35
34
|
long_desc <<-DESC
|
|
36
35
|
Initializes a configuration file where you can set default options for
|
data/lib/github_cli/command.rb
CHANGED
|
@@ -6,17 +6,18 @@ module GithubCLI
|
|
|
6
6
|
|
|
7
7
|
API_CLASSES = %w(
|
|
8
8
|
c_l_i
|
|
9
|
-
repo download key fork
|
|
10
|
-
issue label
|
|
9
|
+
repo download key fork hook watch collab
|
|
10
|
+
issue label milestone
|
|
11
11
|
tag tree blob reference commit
|
|
12
12
|
pull
|
|
13
|
+
email
|
|
14
|
+
event
|
|
13
15
|
)
|
|
14
16
|
|
|
15
17
|
HELP_COMMAND = 'help'
|
|
16
18
|
|
|
17
19
|
class Comm < Struct.new(:namespace, :name, :desc, :usage); end
|
|
18
20
|
|
|
19
|
-
|
|
20
21
|
def self.output_formats
|
|
21
22
|
{
|
|
22
23
|
'csv' => nil,
|
|
@@ -27,17 +28,22 @@ module GithubCLI
|
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
map "ls" => :list,
|
|
31
|
+
"all" => :list,
|
|
30
32
|
"del" => :delete
|
|
31
33
|
|
|
32
34
|
class_option :format, :type => :string, :aliases => '-f',
|
|
33
35
|
:default => 'table',
|
|
34
36
|
:banner => output_formats.keys.join('|'),
|
|
35
37
|
:desc => "Format of the output"
|
|
38
|
+
class_option :pager, :type => :boolean, :aliases => '-p',
|
|
39
|
+
:default => true,
|
|
40
|
+
:desc => "Determines if the output is paged."
|
|
36
41
|
|
|
37
42
|
def self.banner(task, namespace=true, subcommand=true)
|
|
38
43
|
"#{basename} #{task.formatted_usage(self, true, subcommand)}"
|
|
39
44
|
end
|
|
40
45
|
|
|
46
|
+
|
|
41
47
|
def self.all
|
|
42
48
|
commands = []
|
|
43
49
|
Base.subclasses.each do |klass|
|
data/lib/github_cli/commands.rb
CHANGED
|
@@ -7,12 +7,15 @@ module GithubCLI
|
|
|
7
7
|
autoload :Collaborators, 'github_cli/commands/collaborators'
|
|
8
8
|
autoload :Commits, 'github_cli/commands/commits'
|
|
9
9
|
autoload :Downloads, 'github_cli/commands/downloads'
|
|
10
|
+
autoload :Emails, 'github_cli/commands/emails'
|
|
11
|
+
autoload :Events, 'github_cli/commands/events'
|
|
10
12
|
autoload :Forks, 'github_cli/commands/forks'
|
|
11
13
|
autoload :Gists, 'github_cli/commands/gists'
|
|
12
14
|
autoload :Hooks, 'github_cli/commands/hooks'
|
|
13
15
|
autoload :Issues, 'github_cli/commands/issues'
|
|
14
16
|
autoload :Keys, 'github_cli/commands/keys'
|
|
15
17
|
autoload :Labels, 'github_cli/commands/labels'
|
|
18
|
+
autoload :Milestones, 'github_cli/commands/milestones'
|
|
16
19
|
autoload :PullRequests, 'github_cli/commands/pull_requests'
|
|
17
20
|
autoload :References, 'github_cli/commands/references'
|
|
18
21
|
autoload :Repositories, 'github_cli/commands/repositories'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module GithubCLI
|
|
4
|
+
class Commands::Emails < Command
|
|
5
|
+
|
|
6
|
+
namespace :email
|
|
7
|
+
|
|
8
|
+
desc 'list', 'Lists email addresses for the authenticated user'
|
|
9
|
+
method_option :params, :type => :hash, :default => {},
|
|
10
|
+
:desc => 'Additional request parameters e.i per_page:100'
|
|
11
|
+
def list()
|
|
12
|
+
Email.all options[:params], options[:format]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
desc 'add <email(s)>', 'Add email address(es) for the authenticated user'
|
|
16
|
+
long_desc <<-DESC
|
|
17
|
+
You can include a single email address or an array of addresses
|
|
18
|
+
DESC
|
|
19
|
+
method_option :params, :type => :hash, :default => {},
|
|
20
|
+
:desc => 'Additonal request parameters e.i per_page:100'
|
|
21
|
+
def add(*emails)
|
|
22
|
+
Email.add emails, options[:params], options[:format]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
desc 'delete <email(s)>', 'Delete email address(es) for the authenticated user'
|
|
26
|
+
long_desc <<-DESC
|
|
27
|
+
You can include a single email address or an array of addresses
|
|
28
|
+
DESC
|
|
29
|
+
method_option :params, :type => :hash, :default => {},
|
|
30
|
+
:desc => 'Additonal request parameters e.i per_page:100'
|
|
31
|
+
def delete(*emails)
|
|
32
|
+
Email.delete emails, options[:params], options[:format]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end # Emails
|
|
36
|
+
end # GithubCLI
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module GithubCLI
|
|
4
|
+
class Commands::Events < Command
|
|
5
|
+
|
|
6
|
+
namespace :event
|
|
7
|
+
|
|
8
|
+
desc 'public', 'Lists all public events'
|
|
9
|
+
method_option :params, :type => :hash, :default => {},
|
|
10
|
+
:desc => 'Additional request parameters e.i per_page:100'
|
|
11
|
+
def public
|
|
12
|
+
Event.public options[:params], options[:format]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
desc 'repo <user> <repo>', 'Lists all repository events for a given user'
|
|
16
|
+
method_option :params, :type => :hash, :default => {},
|
|
17
|
+
:desc => 'Additional request parameters e.i per_page:100'
|
|
18
|
+
def repo(user, repo)
|
|
19
|
+
Event.repository user, repo, options[:params], options[:format]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
desc 'issue <user> <repo>', 'Lists all issue events for a given repository'
|
|
23
|
+
method_option :params, :type => :hash, :default => {},
|
|
24
|
+
:desc => 'Additional request parameters e.i per_page:100'
|
|
25
|
+
def issue(user, repo)
|
|
26
|
+
Event.issue user, repo, options[:params], options[:format]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
desc 'network <user> <repo>', 'Lists all public events for a network of repositories'
|
|
30
|
+
method_option :params, :type => :hash, :default => {},
|
|
31
|
+
:desc => 'Additional request parameters e.i per_page:100'
|
|
32
|
+
def network(user, repo)
|
|
33
|
+
Event.network user, repo, options[:params], options[:format]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
desc 'org <org>', 'Lists all public events for an organization'
|
|
37
|
+
method_option :params, :type => :hash, :default => {},
|
|
38
|
+
:desc => 'Additional request parameters e.i per_page:100'
|
|
39
|
+
def org(org)
|
|
40
|
+
Event.organization org, options[:params], options[:format]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
desc 'received <user>', 'Lists all events that a user has received'
|
|
44
|
+
method_option :public, :type => :boolean,
|
|
45
|
+
:desc => 'Lists all public events that a user has received'
|
|
46
|
+
method_option :params, :type => :hash, :default => {},
|
|
47
|
+
:desc => 'Additional request parameters e.i per_page:100'
|
|
48
|
+
long_desc <<-DESC
|
|
49
|
+
These are events that you’ve received by watching repos and following users.
|
|
50
|
+
If you are authenticated as the given user, you will see private events.
|
|
51
|
+
Otherwise, you’ll only see public events.
|
|
52
|
+
DESC
|
|
53
|
+
def received(user)
|
|
54
|
+
if options[:public]
|
|
55
|
+
options[:params]['public'] = true
|
|
56
|
+
end
|
|
57
|
+
Event.received user, options[:params], options[:format]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
desc 'performed <user>', 'Lists all events that a user has performed'
|
|
61
|
+
method_option :public, :type => :boolean,
|
|
62
|
+
:desc => 'Lists all public events that a user has received'
|
|
63
|
+
method_option :params, :type => :hash, :default => {},
|
|
64
|
+
:desc => 'Additional request parameters e.i per_page:100'
|
|
65
|
+
long_desc <<-DESC
|
|
66
|
+
If you are authenticated as the given user, you will see your private
|
|
67
|
+
events. Otherwise, you’ll only see public events.
|
|
68
|
+
DESC
|
|
69
|
+
def performed(user)
|
|
70
|
+
if options[:public]
|
|
71
|
+
options[:params]['public'] = true
|
|
72
|
+
end
|
|
73
|
+
Event.performed user, options[:params], options[:format]
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
desc 'user_org <user> <org>', "Lists all events for a user's organization"
|
|
77
|
+
method_option :params, :type => :hash, :default => {},
|
|
78
|
+
:desc => 'Additional request parameters e.i per_page:100'
|
|
79
|
+
long_desc <<-DESC
|
|
80
|
+
This is the user’s organization dashboard. You must be authenticated
|
|
81
|
+
as the user to view this.
|
|
82
|
+
DESC
|
|
83
|
+
def user_org(user, org)
|
|
84
|
+
Event.user_org user, org, options[:params], options[:format]
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end # Events
|
|
88
|
+
end # GithubCLI
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module GithubCLI
|
|
4
|
+
class Commands::Milestones < Command
|
|
5
|
+
|
|
6
|
+
namespace :milestone
|
|
7
|
+
|
|
8
|
+
desc 'list <user> <repo>', 'List milestones for a repository'
|
|
9
|
+
long_desc <<-DESC
|
|
10
|
+
Parameters
|
|
11
|
+
|
|
12
|
+
state - open, closed, default: open\n
|
|
13
|
+
sort - due_date, completeness, default: due_date\n
|
|
14
|
+
direction - asc, desc, default: desc\n
|
|
15
|
+
DESC
|
|
16
|
+
method_option :params, :type => :hash, :default => {},
|
|
17
|
+
:desc => 'Additional request parameters e.i per_page:100'
|
|
18
|
+
def list(user, repo)
|
|
19
|
+
Milestone.all user, repo, options[:params], options[:format]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
desc 'get <user> <repo> <id>', 'Get a single milestone'
|
|
23
|
+
method_option :params, :type => :hash, :default => {},
|
|
24
|
+
:desc => 'Additional request parameters e.i per_page:100'
|
|
25
|
+
def get(user, repo, id)
|
|
26
|
+
Milestone.get user, repo, id, options[:params], options[:format]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
desc 'create <user> <repo>', 'Create a milestone'
|
|
30
|
+
long_desc <<-DESC
|
|
31
|
+
Parameters
|
|
32
|
+
|
|
33
|
+
title - Required string\n
|
|
34
|
+
state - Optional string - open or closed\n
|
|
35
|
+
description - Optional string\n
|
|
36
|
+
due_on - Optional string - ISO 8601 time\n
|
|
37
|
+
DESC
|
|
38
|
+
method_option :params, :type => :hash, :default => {},
|
|
39
|
+
:desc => 'Additonal request parameters e.i per_page:100'
|
|
40
|
+
def create(user, repo)
|
|
41
|
+
Milestone.create user, repo, options[:params], options[:format]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
desc 'update <user> <repo> <id>', 'Update a milestone'
|
|
45
|
+
long_desc <<-DESC
|
|
46
|
+
Parameters
|
|
47
|
+
|
|
48
|
+
title - Required string\n
|
|
49
|
+
state - Optional string - open or closed\n
|
|
50
|
+
description - Optional string\n
|
|
51
|
+
due_on - Optional string - ISO 8601 time\n
|
|
52
|
+
DESC
|
|
53
|
+
method_option :params, :type => :hash, :default => {},
|
|
54
|
+
:desc => 'Additonal request parameters e.i per_page:100'
|
|
55
|
+
def upload(resource, filename)
|
|
56
|
+
Download.upload resource, filename, options[:format]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
desc 'delete <user> <repo> <id>', 'Delete a milestone'
|
|
60
|
+
method_option :params, :type => :hash, :default => {},
|
|
61
|
+
:desc => 'Additonal request parameters e.i per_page:100'
|
|
62
|
+
def delete(user, repo, id)
|
|
63
|
+
Milestone.delete user, repo, id, options[:params], options[:format]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
end # Milestones
|
|
67
|
+
end # GithubCLI
|
data/lib/github_cli/config.rb
CHANGED
|
@@ -18,6 +18,12 @@ module GithubCLI
|
|
|
18
18
|
desc "download <command>", "Leverage Downloads API"
|
|
19
19
|
subcommand "download", GithubCLI::Commands::Downloads
|
|
20
20
|
|
|
21
|
+
desc "email <command>", "Leverage Emails API"
|
|
22
|
+
subcommand "email", GithubCLI::Commands::Emails
|
|
23
|
+
|
|
24
|
+
desc "event <command>", "Leverage Events API"
|
|
25
|
+
subcommand "event", GithubCLI::Commands::Events
|
|
26
|
+
|
|
21
27
|
desc "fork <command>", "Leverage Forks API"
|
|
22
28
|
subcommand "fork", GithubCLI::Commands::Forks
|
|
23
29
|
|
|
@@ -36,6 +42,9 @@ module GithubCLI
|
|
|
36
42
|
desc "label <command>", "Leverage Labels API"
|
|
37
43
|
subcommand "label", GithubCLI::Commands::Labels
|
|
38
44
|
|
|
45
|
+
desc "milestone <command>", "Leverage Milestones API"
|
|
46
|
+
subcommand "milestone", GithubCLI::Commands::Milestones
|
|
47
|
+
|
|
39
48
|
desc "pull <command>", "Leverage Pull Requests API"
|
|
40
49
|
subcommand "pull", GithubCLI::Commands::PullRequests
|
|
41
50
|
|
data/lib/github_cli/terminal.rb
CHANGED
|
@@ -63,13 +63,23 @@ module GithubCLI
|
|
|
63
63
|
GithubCLI.ui.info "ghc: '#{cmd}' is not a ghc command. See 'ghc --help'."
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
-
def print_program_name
|
|
66
|
+
def print_program_name(print=true)
|
|
67
67
|
GithubCLI.ui.info <<-TEXT
|
|
68
68
|
|
|
69
69
|
#{GithubCLI.program_name}
|
|
70
70
|
|
|
71
71
|
TEXT
|
|
72
72
|
end
|
|
73
|
+
|
|
74
|
+
def print_usage(print=true)
|
|
75
|
+
if print
|
|
76
|
+
GithubCLI.ui.info <<-TEXT
|
|
77
|
+
|
|
78
|
+
Usage: ghc <command> <subcommand> [<args>]
|
|
79
|
+
|
|
80
|
+
TEXT
|
|
81
|
+
end
|
|
82
|
+
end
|
|
73
83
|
end
|
|
74
84
|
|
|
75
85
|
end # Terminal
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'thor'
|
|
2
|
+
|
|
3
|
+
class Thor
|
|
4
|
+
include Thor::Base
|
|
5
|
+
|
|
6
|
+
class << self
|
|
7
|
+
|
|
8
|
+
def help(shell, subcommand = false)
|
|
9
|
+
list = printable_tasks(true, subcommand)
|
|
10
|
+
Thor::Util.thor_classes_in(self).each do |klass|
|
|
11
|
+
list += klass.printable_tasks(false)
|
|
12
|
+
end
|
|
13
|
+
list.sort!{ |a,b| a[0] <=> b[0] }
|
|
14
|
+
|
|
15
|
+
shell.say "Commands:"
|
|
16
|
+
shell.print_table(list, :indent => 2, :truncate => true)
|
|
17
|
+
shell.say
|
|
18
|
+
class_options_help(shell)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def subcommand_help(cmd)
|
|
22
|
+
desc "help <command>", "Describe subcommands or one specific subcommand"
|
|
23
|
+
class_eval <<-RUBY
|
|
24
|
+
def help(task = nil, subcommand = true); super; end
|
|
25
|
+
RUBY
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
desc "help <command>", "Describe available commands or one specific command"
|
|
30
|
+
def help(task = nil, subcommand = false)
|
|
31
|
+
task ? self.class.task_help(shell, task) : self.class.help(shell, subcommand)
|
|
32
|
+
end
|
|
33
|
+
end # Thor
|
data/lib/github_cli/version.rb
CHANGED
|
@@ -5,16 +5,11 @@ describe GithubCLI::Config do
|
|
|
5
5
|
let(:config_name) { 'simple_config' }
|
|
6
6
|
let(:path) { "/users/#{filename}" }
|
|
7
7
|
|
|
8
|
-
before :all do
|
|
9
|
-
unless File.exists?(fixture_path('.githubrc'))
|
|
10
|
-
File.symlink(fixture_path(config_name), fixture_path('.githubrc'))
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
8
|
context 'global' do
|
|
15
9
|
let(:config) { GithubCLI::Config.new fixture_path }
|
|
16
10
|
|
|
17
11
|
before do
|
|
12
|
+
config.stub(:global_options_file) { fixture_path(config_name) }
|
|
18
13
|
File.stub(:open) { YAML.load fixture('simple_config') }
|
|
19
14
|
end
|
|
20
15
|
|
|
@@ -24,9 +19,16 @@ describe GithubCLI::Config do
|
|
|
24
19
|
end
|
|
25
20
|
|
|
26
21
|
context 'array access' do
|
|
22
|
+
it 'returns value for the key' do
|
|
23
|
+
config['basic_auth'].should == 'login:password'
|
|
24
|
+
end
|
|
25
|
+
|
|
27
26
|
it 'searches in commands' do
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
config['issue-list'].should == { 'inputs' => 'ticket' }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'returns nil for missing key' do
|
|
31
|
+
config['non-existent'].should be_nil
|
|
30
32
|
end
|
|
31
33
|
end
|
|
32
34
|
|
|
@@ -109,4 +111,7 @@ describe GithubCLI::Config do
|
|
|
109
111
|
end
|
|
110
112
|
end
|
|
111
113
|
|
|
114
|
+
context 'local' do
|
|
115
|
+
end
|
|
116
|
+
|
|
112
117
|
end # GithubCLI::Config
|
|
@@ -4,7 +4,8 @@ describe GithubCLI::Helpers do
|
|
|
4
4
|
subject { described_class }
|
|
5
5
|
|
|
6
6
|
it 'throws error if config file does not exist' do
|
|
7
|
-
|
|
7
|
+
pending
|
|
8
|
+
subject.stub(:find_configfile).and_return nil
|
|
8
9
|
expect {
|
|
9
10
|
subject.default_configfile
|
|
10
11
|
}.to raise_error(GithubCLI::ConfigFileNotFound)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: github_cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-05-
|
|
12
|
+
date: 2012-05-30 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: github_api
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &2160356360 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ~>
|
|
@@ -21,10 +21,10 @@ dependencies:
|
|
|
21
21
|
version: '0.5'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *2160356360
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: thor
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &2160355220 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ! '>='
|
|
@@ -32,10 +32,10 @@ dependencies:
|
|
|
32
32
|
version: '0'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *2160355220
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: rspec
|
|
38
|
-
requirement: &
|
|
38
|
+
requirement: &2160354060 !ruby/object:Gem::Requirement
|
|
39
39
|
none: false
|
|
40
40
|
requirements:
|
|
41
41
|
- - ! '>='
|
|
@@ -43,10 +43,10 @@ dependencies:
|
|
|
43
43
|
version: '0'
|
|
44
44
|
type: :development
|
|
45
45
|
prerelease: false
|
|
46
|
-
version_requirements: *
|
|
46
|
+
version_requirements: *2160354060
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: aruba
|
|
49
|
-
requirement: &
|
|
49
|
+
requirement: &2160353500 !ruby/object:Gem::Requirement
|
|
50
50
|
none: false
|
|
51
51
|
requirements:
|
|
52
52
|
- - ! '>='
|
|
@@ -54,10 +54,10 @@ dependencies:
|
|
|
54
54
|
version: '0'
|
|
55
55
|
type: :development
|
|
56
56
|
prerelease: false
|
|
57
|
-
version_requirements: *
|
|
57
|
+
version_requirements: *2160353500
|
|
58
58
|
- !ruby/object:Gem::Dependency
|
|
59
59
|
name: rake
|
|
60
|
-
requirement: &
|
|
60
|
+
requirement: &2160352620 !ruby/object:Gem::Requirement
|
|
61
61
|
none: false
|
|
62
62
|
requirements:
|
|
63
63
|
- - ! '>='
|
|
@@ -65,7 +65,7 @@ dependencies:
|
|
|
65
65
|
version: '0'
|
|
66
66
|
type: :development
|
|
67
67
|
prerelease: false
|
|
68
|
-
version_requirements: *
|
|
68
|
+
version_requirements: *2160352620
|
|
69
69
|
description: CLI-based access to GitHub API v3
|
|
70
70
|
email:
|
|
71
71
|
- pmurach@gmail.com
|
|
@@ -102,12 +102,15 @@ files:
|
|
|
102
102
|
- lib/github_cli/apis/collaborator.rb
|
|
103
103
|
- lib/github_cli/apis/commit.rb
|
|
104
104
|
- lib/github_cli/apis/download.rb
|
|
105
|
+
- lib/github_cli/apis/email.rb
|
|
106
|
+
- lib/github_cli/apis/event.rb
|
|
105
107
|
- lib/github_cli/apis/fork.rb
|
|
106
108
|
- lib/github_cli/apis/gist.rb
|
|
107
109
|
- lib/github_cli/apis/hook.rb
|
|
108
110
|
- lib/github_cli/apis/issue.rb
|
|
109
111
|
- lib/github_cli/apis/key.rb
|
|
110
112
|
- lib/github_cli/apis/label.rb
|
|
113
|
+
- lib/github_cli/apis/milestone.rb
|
|
111
114
|
- lib/github_cli/apis/pull_request.rb
|
|
112
115
|
- lib/github_cli/apis/reference.rb
|
|
113
116
|
- lib/github_cli/apis/repository.rb
|
|
@@ -122,12 +125,15 @@ files:
|
|
|
122
125
|
- lib/github_cli/commands/collaborators.rb
|
|
123
126
|
- lib/github_cli/commands/commits.rb
|
|
124
127
|
- lib/github_cli/commands/downloads.rb
|
|
128
|
+
- lib/github_cli/commands/emails.rb
|
|
129
|
+
- lib/github_cli/commands/events.rb
|
|
125
130
|
- lib/github_cli/commands/forks.rb
|
|
126
131
|
- lib/github_cli/commands/gists.rb
|
|
127
132
|
- lib/github_cli/commands/hooks.rb
|
|
128
133
|
- lib/github_cli/commands/issues.rb
|
|
129
134
|
- lib/github_cli/commands/keys.rb
|
|
130
135
|
- lib/github_cli/commands/labels.rb
|
|
136
|
+
- lib/github_cli/commands/milestones.rb
|
|
131
137
|
- lib/github_cli/commands/pull_requests.rb
|
|
132
138
|
- lib/github_cli/commands/references.rb
|
|
133
139
|
- lib/github_cli/commands/repositories.rb
|
|
@@ -143,6 +149,7 @@ files:
|
|
|
143
149
|
- lib/github_cli/helpers.rb
|
|
144
150
|
- lib/github_cli/subcommands.rb
|
|
145
151
|
- lib/github_cli/terminal.rb
|
|
152
|
+
- lib/github_cli/thor_ext.rb
|
|
146
153
|
- lib/github_cli/ui.rb
|
|
147
154
|
- lib/github_cli/util.rb
|
|
148
155
|
- lib/github_cli/version.rb
|