github_cli 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +3 -3
- data/README.md +30 -0
- data/bin/ghc +13 -1
- data/features/repositories.feature +9 -0
- data/github_cli.gemspec +1 -1
- data/lib/github_cli.rb +2 -0
- data/lib/github_cli/api.rb +7 -2
- data/lib/github_cli/apis.rb +4 -0
- data/lib/github_cli/apis/authorization.rb +20 -10
- data/lib/github_cli/apis/blob.rb +8 -4
- data/lib/github_cli/apis/collaborator.rb +34 -0
- data/lib/github_cli/apis/commit.rb +8 -4
- data/lib/github_cli/apis/download.rb +20 -10
- data/lib/github_cli/apis/fork.rb +8 -4
- data/lib/github_cli/apis/gist.rb +70 -0
- data/lib/github_cli/apis/hook.rb +24 -12
- data/lib/github_cli/apis/issue.rb +40 -0
- data/lib/github_cli/apis/key.rb +20 -10
- data/lib/github_cli/apis/label.rb +40 -18
- data/lib/github_cli/apis/pull_request.rb +32 -16
- data/lib/github_cli/apis/reference.rb +20 -10
- data/lib/github_cli/apis/repository.rb +36 -19
- data/lib/github_cli/apis/tag.rb +8 -4
- data/lib/github_cli/apis/tree.rb +8 -4
- data/lib/github_cli/apis/watching.rb +20 -10
- data/lib/github_cli/command.rb +19 -0
- data/lib/github_cli/commands.rb +2 -0
- data/lib/github_cli/commands/authorizations.rb +5 -5
- data/lib/github_cli/commands/blobs.rb +2 -2
- data/lib/github_cli/commands/collaborators.rb +37 -0
- data/lib/github_cli/commands/commits.rb +2 -2
- data/lib/github_cli/commands/downloads.rb +5 -5
- data/lib/github_cli/commands/forks.rb +2 -2
- data/lib/github_cli/commands/gists.rb +103 -0
- data/lib/github_cli/commands/hooks.rb +6 -6
- data/lib/github_cli/commands/issues.rb +67 -18
- data/lib/github_cli/commands/keys.rb +5 -5
- data/lib/github_cli/commands/labels.rb +8 -8
- data/lib/github_cli/commands/pull_requests.rb +8 -8
- data/lib/github_cli/commands/references.rb +5 -5
- data/lib/github_cli/commands/repositories.rb +20 -20
- data/lib/github_cli/commands/tags.rb +2 -2
- data/lib/github_cli/commands/trees.rb +2 -2
- data/lib/github_cli/commands/watching.rb +5 -5
- data/lib/github_cli/errors.rb +33 -2
- data/lib/github_cli/formatters.rb +8 -0
- data/lib/github_cli/formatters/csv.rb +39 -0
- data/lib/github_cli/formatters/table.rb +36 -0
- data/lib/github_cli/subcommands.rb +6 -0
- data/lib/github_cli/terminal.rb +25 -0
- data/lib/github_cli/util.rb +35 -0
- data/lib/github_cli/version.rb +1 -1
- data/spec/github_cli/util_spec.rb +37 -0
- metadata +26 -13
@@ -9,14 +9,14 @@ module GithubCLI
|
|
9
9
|
method_option :params, :type => :hash, :default => {},
|
10
10
|
:desc => 'Additional request parameters e.i per_page:100'
|
11
11
|
def list(user, repo)
|
12
|
-
Key.all user, repo, options[:params]
|
12
|
+
Key.all user, repo, options[:params], options[:format]
|
13
13
|
end
|
14
14
|
|
15
15
|
desc 'get <user> <repo> <id>', 'Get a key'
|
16
16
|
method_option :params, :type => :hash, :default => {},
|
17
17
|
:desc => 'Additional request parameters e.i per_page:100'
|
18
18
|
def get(user, repo, id)
|
19
|
-
Key.get user, repo, id, options[:params]
|
19
|
+
Key.get user, repo, id, options[:params], options[:format]
|
20
20
|
end
|
21
21
|
|
22
22
|
desc 'create <user> <repo>', 'Create a new key'
|
@@ -29,7 +29,7 @@ module GithubCLI
|
|
29
29
|
method_option :params, :type => :hash, :default => {},
|
30
30
|
:desc => 'Additonal request parameters e.i per_page:100'
|
31
31
|
def create(user, repo)
|
32
|
-
Key.create user, repo, options[:params]
|
32
|
+
Key.create user, repo, options[:params], options[:format]
|
33
33
|
end
|
34
34
|
|
35
35
|
desc 'edit <user> <repo> <id>', 'Edit a key'
|
@@ -42,14 +42,14 @@ module GithubCLI
|
|
42
42
|
method_option :params, :type => :hash, :default => {},
|
43
43
|
:desc => 'Additonal request parameters e.i per_page:100'
|
44
44
|
def edit(user, repo, id)
|
45
|
-
Key.edit user, repo, id, options[:params]
|
45
|
+
Key.edit user, repo, id, options[:params], options[:format]
|
46
46
|
end
|
47
47
|
|
48
48
|
desc 'delete <user> <repo> <id>', 'Delete a key'
|
49
49
|
method_option :params, :type => :hash, :default => {},
|
50
50
|
:desc => 'Additonal request parameters e.i per_page:100'
|
51
51
|
def delete(user, repo, id)
|
52
|
-
Key.delete user, repo, id, options[:params]
|
52
|
+
Key.delete user, repo, id, options[:params], options[:format]
|
53
53
|
end
|
54
54
|
|
55
55
|
end # Keys
|
@@ -9,14 +9,14 @@ module GithubCLI
|
|
9
9
|
method_option :params, :type => :hash, :default => {},
|
10
10
|
:desc => 'Additonal request parameters e.i per_page:100'
|
11
11
|
def list(user, repo)
|
12
|
-
Label.all user, repo, options[:params]
|
12
|
+
Label.all user, repo, options[:params], options[:format]
|
13
13
|
end
|
14
14
|
|
15
15
|
desc 'get <user> <repo> <name>', 'Get a single label.'
|
16
16
|
method_option :params, :type => :hash, :default => {},
|
17
17
|
:desc => 'Additonal request parameters e.i per_page:100'
|
18
18
|
def get(user, repo, name)
|
19
|
-
Label.get user, repo, name, options[:params]
|
19
|
+
Label.get user, repo, name, options[:params], options[:format]
|
20
20
|
end
|
21
21
|
|
22
22
|
desc 'create <user> <repo>', 'Create a label.'
|
@@ -28,28 +28,28 @@ module GithubCLI
|
|
28
28
|
method_option :params, :type => :hash, :default => {},
|
29
29
|
:desc => 'Additonal request parameters e.i per_page:100'
|
30
30
|
def create(user, repo)
|
31
|
-
Label.create user, repo, options[:params]
|
31
|
+
Label.create user, repo, options[:params], options[:format]
|
32
32
|
end
|
33
33
|
|
34
34
|
desc 'update <user> <repo> <name>', 'Update a label.'
|
35
35
|
method_option :params, :type => :hash, :default => {},
|
36
36
|
:desc => 'Additonal request parameters e.i per_page:100'
|
37
37
|
def update(user, repo, name)
|
38
|
-
Label.update user, repo, name, options[:params]
|
38
|
+
Label.update user, repo, name, options[:params], options[:format]
|
39
39
|
end
|
40
40
|
|
41
41
|
desc 'delete <user> <repo> <name>', 'Delete a label.'
|
42
42
|
method_option :params, :type => :hash, :default => {},
|
43
43
|
:desc => 'Additonal request parameters e.i per_page:100'
|
44
44
|
def delete(user, repo, name)
|
45
|
-
Label.delete user, repo, name, options[:params]
|
45
|
+
Label.delete user, repo, name, options[:params], options[:format]
|
46
46
|
end
|
47
47
|
|
48
48
|
desc 'issue <user> <repo> <number>', 'List labels on an issue.'
|
49
49
|
method_option :params, :type => :hash, :default => {},
|
50
50
|
:desc => 'Additonal request parameters e.i per_page:100'
|
51
51
|
def issue(user, repo, number)
|
52
|
-
Label.issue user, repo, number, options[:params]
|
52
|
+
Label.issue user, repo, number, options[:params], options[:format]
|
53
53
|
end
|
54
54
|
|
55
55
|
desc 'add <user> <repo> <number>', 'Add labels to an issue.'
|
@@ -67,7 +67,7 @@ module GithubCLI
|
|
67
67
|
method_option :params, :type => :hash, :default => {},
|
68
68
|
:desc => 'Additonal request parameters e.i per_page:100'
|
69
69
|
def remove(user, repo, number)
|
70
|
-
Label.issue user, repo, number, options[:name], options[:params]
|
70
|
+
Label.issue user, repo, number, options[:name], options[:params], options[:format]
|
71
71
|
end
|
72
72
|
|
73
73
|
desc 'replace <user> <repo> <number>', 'Replace all labels for an issue.'
|
@@ -83,7 +83,7 @@ module GithubCLI
|
|
83
83
|
method_option :params, :type => :hash, :default => {},
|
84
84
|
:desc => 'Additonal request parameters e.i per_page:100'
|
85
85
|
def milestone(user, repo, number)
|
86
|
-
Label.milestone user, repo, number, options[:params]
|
86
|
+
Label.milestone user, repo, number, options[:params], options[:format]
|
87
87
|
end
|
88
88
|
|
89
89
|
end # Labels
|
@@ -9,56 +9,56 @@ module GithubCLI
|
|
9
9
|
method_option :params, :type => :hash, :default => {},
|
10
10
|
:desc => 'Additonal request parameters e.i per_page:100'
|
11
11
|
def get(user, repo, number)
|
12
|
-
PullRequest.get user, repo, number, options[:params]
|
12
|
+
PullRequest.get user, repo, number, options[:params], options[:format]
|
13
13
|
end
|
14
14
|
|
15
15
|
desc 'list <user> <repo>', 'List all Pull Requests'
|
16
16
|
method_option :params, :type => :hash, :default => {},
|
17
17
|
:desc => 'Additonal request parameters e.i per_page:100'
|
18
18
|
def list(user, repo)
|
19
|
-
PullRequest.list user, repo, options[:params]
|
19
|
+
PullRequest.list user, repo, options[:params], options[:format]
|
20
20
|
end
|
21
21
|
|
22
22
|
desc 'create <user> <repo>', 'Create a new Pull Request'
|
23
23
|
method_option :params, :type => :hash, :default => {},
|
24
24
|
:desc => 'Additonal request parameters e.i per_page:100'
|
25
25
|
def create(user, repo)
|
26
|
-
PullRequest.create user, repo, options[:params]
|
26
|
+
PullRequest.create user, repo, options[:params], options[:format]
|
27
27
|
end
|
28
28
|
|
29
29
|
desc 'update <user> <repo> <number>', 'Update a Pull Request'
|
30
30
|
method_option :params, :type => :hash, :default => {},
|
31
31
|
:desc => 'Additonal request parameters e.i per_page:100'
|
32
32
|
def update(user, repo, number)
|
33
|
-
PullRequest.update user, repo, number, options[:params]
|
33
|
+
PullRequest.update user, repo, number, options[:params], options[:format]
|
34
34
|
end
|
35
35
|
|
36
36
|
desc 'commits <user> <repo> <number>', 'List commits on a Pull Request'
|
37
37
|
method_option :params, :type => :hash, :default => {},
|
38
38
|
:desc => 'Additonal request parameters e.i per_page:100'
|
39
39
|
def commits(user, repo, number)
|
40
|
-
PullRequest.commits user, repo, number, options[:params]
|
40
|
+
PullRequest.commits user, repo, number, options[:params], options[:format]
|
41
41
|
end
|
42
42
|
|
43
43
|
desc 'files <user> <repo> <number>', 'List Pull Requests Files'
|
44
44
|
method_option :params, :type => :hash, :default => {},
|
45
45
|
:desc => 'Additonal request parameters e.i per_page:100'
|
46
46
|
def files(user, repo, number)
|
47
|
-
PullRequest.files user, repo, number, options[:params]
|
47
|
+
PullRequest.files user, repo, number, options[:params], options[:format]
|
48
48
|
end
|
49
49
|
|
50
50
|
desc 'merged <user> <repo> <number>', 'Get if a pull request has been merged'
|
51
51
|
method_option :params, :type => :hash, :default => {},
|
52
52
|
:desc => 'Additonal request parameters e.i per_page:100'
|
53
53
|
def merged(user, repo, number)
|
54
|
-
PullRequest.merged user, repo, number, options[:params]
|
54
|
+
PullRequest.merged user, repo, number, options[:params], options[:format]
|
55
55
|
end
|
56
56
|
|
57
57
|
desc 'merge <user> <repo> <number>', 'Merge a pull request'
|
58
58
|
method_option :params, :type => :hash, :default => {},
|
59
59
|
:desc => 'Additonal request parameters e.i per_page:100'
|
60
60
|
def merge(user, repo, number)
|
61
|
-
PullRequest.merge user, repo, number, options[:params]
|
61
|
+
PullRequest.merge user, repo, number, options[:params], options[:format]
|
62
62
|
end
|
63
63
|
|
64
64
|
end # PullRequests
|
@@ -11,14 +11,14 @@ module GithubCLI
|
|
11
11
|
:desc => 'Additonal request parameters e.i per_page:100'
|
12
12
|
def list(user, repo)
|
13
13
|
ref = options[:ref] ? options[:ref] : nil
|
14
|
-
Reference.list user, repo, ref, options[:params]
|
14
|
+
Reference.list user, repo, ref, options[:params], options[:format]
|
15
15
|
end
|
16
16
|
|
17
17
|
desc 'get <user> <repo> <ref>', 'Get a Reference'
|
18
18
|
method_option :params, :type => :hash, :default => {},
|
19
19
|
:desc => 'Additonal request parameters e.i per_page:100'
|
20
20
|
def get(user, repo, ref)
|
21
|
-
Reference.get user, repo, ref, options[:params]
|
21
|
+
Reference.get user, repo, ref, options[:params], options[:format]
|
22
22
|
end
|
23
23
|
|
24
24
|
desc 'create <user> <repo>', 'Create a new Reference'
|
@@ -31,7 +31,7 @@ module GithubCLI
|
|
31
31
|
method_option :params, :type => :hash, :default => {},
|
32
32
|
:desc => 'Additonal request parameters e.i per_page:100'
|
33
33
|
def create(user, repo)
|
34
|
-
Reference.create user, repo, options[:params]
|
34
|
+
Reference.create user, repo, options[:params], options[:format]
|
35
35
|
end
|
36
36
|
|
37
37
|
desc 'update <user> <repo> <ref>', 'Update a Reference'
|
@@ -44,14 +44,14 @@ module GithubCLI
|
|
44
44
|
method_option :params, :type => :hash, :default => {},
|
45
45
|
:desc => 'Additonal request parameters e.i per_page:100'
|
46
46
|
def update(user, repo, ref)
|
47
|
-
Reference.update user, repo, ref, options[:params]
|
47
|
+
Reference.update user, repo, ref, options[:params], options[:format]
|
48
48
|
end
|
49
49
|
|
50
50
|
desc 'delete <user> <repo> <ref>', 'Delete a Reference'
|
51
51
|
method_option :params, :type => :hash, :default => {},
|
52
52
|
:desc => 'Additonal request parameters e.i per_page:100'
|
53
53
|
def delete(user, repo, ref)
|
54
|
-
Reference.delete user, repo, ref, options[:params]
|
54
|
+
Reference.delete user, repo, ref, options[:params], options[:format]
|
55
55
|
end
|
56
56
|
|
57
57
|
end # References
|
@@ -12,7 +12,7 @@ module GithubCLI
|
|
12
12
|
method_option :user, :type => :string, :aliases => ["-u"],
|
13
13
|
:desc => 'List repositories for <user>',
|
14
14
|
:banner => '<user>'
|
15
|
-
method_option :params, :type => :hash, :default => {},
|
15
|
+
method_option :params, :type => :hash, :default => {}, :aliases => '-p',
|
16
16
|
:desc => 'Additonal request parameters e.i per_page:100'
|
17
17
|
def list
|
18
18
|
if options[:org]
|
@@ -20,14 +20,14 @@ module GithubCLI
|
|
20
20
|
elsif options[:user]
|
21
21
|
options[:params]['user'] = options[:user]
|
22
22
|
end
|
23
|
-
Repository.all options[:params]
|
23
|
+
Repository.all options[:params], options[:format]
|
24
24
|
end
|
25
25
|
|
26
26
|
desc 'get <user> <repo>', 'Get a repository'
|
27
|
-
method_option :params, :type => :hash, :default => {},
|
27
|
+
method_option :params, :type => :hash, :default => {}, :aliases => '-p',
|
28
28
|
:desc => 'Additonal request parameters e.i per_page:100'
|
29
29
|
def get(user, repo)
|
30
|
-
Repository.get user, repo, options[:params]
|
30
|
+
Repository.get user, repo, options[:params], options[:format]
|
31
31
|
end
|
32
32
|
|
33
33
|
desc 'create', 'Create a new repository for the authenticated user.'
|
@@ -49,13 +49,13 @@ module GithubCLI
|
|
49
49
|
method_option :org, :type => :string, :aliases => ["-o"],
|
50
50
|
:desc => 'Create repository in <organization>',
|
51
51
|
:banner => '<organization>'
|
52
|
-
method_option :params, :type => :hash, :default => {},
|
52
|
+
method_option :params, :type => :hash, :default => {}, :aliases => '-p',
|
53
53
|
:desc => 'Additonal request parameters e.i per_page:100'
|
54
54
|
def create
|
55
55
|
if options[:org]
|
56
56
|
options[:params]['org'] = options[:org]
|
57
57
|
end
|
58
|
-
Repository.create options[:params]
|
58
|
+
Repository.create options[:params], options[:format]
|
59
59
|
end
|
60
60
|
|
61
61
|
desc 'edit <user> <repo>', 'Edit <repo> for an <user>.'
|
@@ -72,45 +72,45 @@ module GithubCLI
|
|
72
72
|
has_wiki - Optional boolean - true to enable the wiki for this repository, false to disable it. Default is true \n
|
73
73
|
has_downloads Optional boolean - true to enable downloads for this repository \n
|
74
74
|
DESC
|
75
|
-
method_option :params, :type => :hash, :default => {},
|
75
|
+
method_option :params, :type => :hash, :default => {}, :aliases => '-p',
|
76
76
|
:desc => 'Additonal request parameters e.i per_page:100'
|
77
77
|
def edit(user, repo)
|
78
|
-
Repository.edit user, repo, options[:params]
|
78
|
+
Repository.edit user, repo, options[:params], options[:format]
|
79
79
|
end
|
80
80
|
|
81
81
|
desc 'branches <user> <repo>', 'List branches'
|
82
|
-
method_option :params, :type => :hash, :default => {},
|
82
|
+
method_option :params, :type => :hash, :default => {}, :aliases => '-p',
|
83
83
|
:desc => 'Additonal request parameters e.i per_page:100'
|
84
84
|
def branches(user, repo)
|
85
|
-
Repository.branches user, repo, options[:params]
|
85
|
+
Repository.branches user, repo, options[:params], options[:format]
|
86
86
|
end
|
87
87
|
|
88
|
-
desc '
|
89
|
-
method_option :params, :type => :hash, :default => {},
|
88
|
+
desc 'contribs <user> <repo>', 'List contributors'
|
89
|
+
method_option :params, :type => :hash, :default => {}, :aliases => '-p',
|
90
90
|
:desc => 'Additonal request parameters e.i per_page:100'
|
91
|
-
def
|
92
|
-
Repository.contributors user, repo, options[:params]
|
91
|
+
def contribs(user, repo)
|
92
|
+
Repository.contributors user, repo, options[:params], options[:format]
|
93
93
|
end
|
94
94
|
|
95
95
|
desc 'languages <user> <repo>', 'Listing all languages'
|
96
|
-
method_option :params, :type => :hash, :default => {},
|
96
|
+
method_option :params, :type => :hash, :default => {}, :aliases => '-p',
|
97
97
|
:desc => 'Additonal request parameters e.i per_page:100'
|
98
98
|
def languages(user, repo)
|
99
|
-
Repository.languages user, repo, options[:params]
|
99
|
+
Repository.languages user, repo, options[:params], options[:format]
|
100
100
|
end
|
101
101
|
|
102
102
|
desc 'tags <user> <repo>', 'Listing all tags'
|
103
|
-
method_option :params, :type => :hash, :default => {},
|
103
|
+
method_option :params, :type => :hash, :default => {}, :aliases => '-p',
|
104
104
|
:desc => 'Additonal request parameters e.i per_page:100'
|
105
105
|
def tags(user, repo)
|
106
|
-
Repository.tags user, repo, options[:params]
|
106
|
+
Repository.tags user, repo, options[:params], options[:format]
|
107
107
|
end
|
108
108
|
|
109
109
|
desc 'teams <user> <repo>', 'Listing all teams'
|
110
|
-
method_option :params, :type => :hash, :default => {},
|
110
|
+
method_option :params, :type => :hash, :default => {}, :aliases => '-p',
|
111
111
|
:desc => 'Additonal request parameters e.i per_page:100'
|
112
112
|
def teams(user, repo)
|
113
|
-
Repository.teams user, repo, options[:params]
|
113
|
+
Repository.teams user, repo, options[:params], options[:format]
|
114
114
|
end
|
115
115
|
|
116
116
|
end # Repositories
|
@@ -11,7 +11,7 @@ module GithubCLI
|
|
11
11
|
method_option :params, :type => :hash, :default => {},
|
12
12
|
:desc => 'Additonal request parameters e.i per_page:100'
|
13
13
|
def get(user, repo, sha)
|
14
|
-
Tag.get user, repo, sha, options[:params]
|
14
|
+
Tag.get user, repo, sha, options[:params], options[:format]
|
15
15
|
end
|
16
16
|
|
17
17
|
desc 'create <user> <repo>', 'Create a Tag Object'
|
@@ -35,7 +35,7 @@ module GithubCLI
|
|
35
35
|
method_option :params, :type => :hash, :default => {},
|
36
36
|
:desc => 'Additonal request parameters e.i per_page:100'
|
37
37
|
def create(user, repo)
|
38
|
-
Tag.create user, repo, options[:params]
|
38
|
+
Tag.create user, repo, options[:params], options[:format]
|
39
39
|
end
|
40
40
|
|
41
41
|
end # Tag
|
@@ -14,7 +14,7 @@ module GithubCLI
|
|
14
14
|
if options[:recursive]
|
15
15
|
options[:params]['recursive'] = true
|
16
16
|
end
|
17
|
-
Tree.get user, repo, sha, options[:params]
|
17
|
+
Tree.get user, repo, sha, options[:params], options[:format]
|
18
18
|
end
|
19
19
|
|
20
20
|
desc 'create <user> <repo>', 'Create a new Tree'
|
@@ -37,7 +37,7 @@ module GithubCLI
|
|
37
37
|
method_option :params, :type => :hash, :default => {},
|
38
38
|
:desc => 'Additonal request parameters e.i per_page:100'
|
39
39
|
def create(user, repo)
|
40
|
-
Tree.create user, repo, options[:params]
|
40
|
+
Tree.create user, repo, options[:params], options[:format]
|
41
41
|
end
|
42
42
|
|
43
43
|
end # Blobs
|
@@ -9,7 +9,7 @@ module GithubCLI
|
|
9
9
|
method_option :params, :type => :hash, :default => {},
|
10
10
|
:desc => 'Additional request parameters e.i per_page:100'
|
11
11
|
def watchers(user, repo)
|
12
|
-
Watching.watchers user, repo, options[:params]
|
12
|
+
Watching.watchers user, repo, options[:params], options[:format]
|
13
13
|
end
|
14
14
|
|
15
15
|
desc 'watched', 'Lists repos being watched by a user'
|
@@ -21,28 +21,28 @@ module GithubCLI
|
|
21
21
|
if options[:user]
|
22
22
|
options[:params]['user'] = options[:user]
|
23
23
|
end
|
24
|
-
Watching.watched options[:params]
|
24
|
+
Watching.watched options[:params], options[:format]
|
25
25
|
end
|
26
26
|
|
27
27
|
desc 'watching <user> <repo>', 'Check if you are watching a repository'
|
28
28
|
method_option :params, :type => :hash, :default => {},
|
29
29
|
:desc => 'Additonal request parameters e.i per_page:100'
|
30
30
|
def watching(user, repo)
|
31
|
-
Watching.watching? user, repo, options[:params]
|
31
|
+
Watching.watching? user, repo, options[:params], options[:format]
|
32
32
|
end
|
33
33
|
|
34
34
|
desc 'start <user> <repo>', 'Watch a repository'
|
35
35
|
method_option :params, :type => :hash, :default => {},
|
36
36
|
:desc => 'Additonal request parameters e.i per_page:100'
|
37
37
|
def start(user, repo)
|
38
|
-
Watching.start_watching user, repo, options[:params]
|
38
|
+
Watching.start_watching user, repo, options[:params], options[:format]
|
39
39
|
end
|
40
40
|
|
41
41
|
desc 'stop <user> <repo>', 'Stop watching a repository'
|
42
42
|
method_option :params, :type => :hash, :default => {},
|
43
43
|
:desc => 'Additonal request parameters e.i per_page:100'
|
44
44
|
def stop(user, repo)
|
45
|
-
Watching.stop_watching user, repo, options[:params]
|
45
|
+
Watching.stop_watching user, repo, options[:params], options[:format]
|
46
46
|
end
|
47
47
|
|
48
48
|
end # Watching
|
data/lib/github_cli/errors.rb
CHANGED
@@ -1,6 +1,37 @@
|
|
1
|
-
#
|
1
|
+
# encoding: utf-8
|
2
|
+
|
2
3
|
module GithubCLI
|
3
4
|
|
4
|
-
class
|
5
|
+
class GithubCLIError < StandardError
|
6
|
+
def self.status_code(code)
|
7
|
+
define_method(:status_code) { code }
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# Raised when a configuration file is corrupt or missing.
|
12
|
+
class ConfigFileNotFound < GithubCLIError
|
13
|
+
status_code 10
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
super %{Configuration file corrupt or missing}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Raised when GitHub api raised error
|
21
|
+
class GitHubError < GithubCLIError
|
22
|
+
status_code 11
|
23
|
+
end
|
24
|
+
|
25
|
+
class HTTPError < GithubCLIError
|
26
|
+
status_code 12
|
27
|
+
end
|
28
|
+
|
29
|
+
class UnknownFormatError < GithubCLIError
|
30
|
+
status_code 13
|
31
|
+
|
32
|
+
def initialize(format)
|
33
|
+
super %{Unrecognized formatting options: #{format} }
|
34
|
+
end
|
35
|
+
end
|
5
36
|
|
6
37
|
end # GithubCLI
|