github_cli 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/.travis.yml +3 -0
  2. data/CHANGELOG.md +7 -0
  3. data/Gemfile.lock +4 -4
  4. data/README.md +8 -1
  5. data/features/blob.feature +8 -0
  6. data/features/collaborator.feature +10 -0
  7. data/features/commit.feature +8 -0
  8. data/features/content.feature +9 -0
  9. data/features/gist.feature +15 -0
  10. data/features/pull_request.feature +14 -0
  11. data/features/search.feature +7 -30
  12. data/features/search_commands.feature +33 -0
  13. data/features/watching.feature +11 -0
  14. data/lib/github_cli/apis.rb +2 -0
  15. data/lib/github_cli/apis/content.rb +28 -0
  16. data/lib/github_cli/apis/search.rb +35 -0
  17. data/lib/github_cli/cli.rb +9 -5
  18. data/lib/github_cli/command.rb +2 -1
  19. data/lib/github_cli/commands.rb +2 -0
  20. data/lib/github_cli/commands/blobs.rb +0 -4
  21. data/lib/github_cli/commands/collaborators.rb +0 -8
  22. data/lib/github_cli/commands/commits.rb +0 -4
  23. data/lib/github_cli/commands/contents.rb +49 -0
  24. data/lib/github_cli/commands/downloads.rb +0 -8
  25. data/lib/github_cli/commands/emails.rb +0 -6
  26. data/lib/github_cli/commands/events.rb +0 -16
  27. data/lib/github_cli/commands/followers.rb +0 -10
  28. data/lib/github_cli/commands/forks.rb +0 -4
  29. data/lib/github_cli/commands/gists.rb +0 -18
  30. data/lib/github_cli/commands/hooks.rb +0 -10
  31. data/lib/github_cli/commands/issues.rb +0 -10
  32. data/lib/github_cli/commands/keys.rb +0 -10
  33. data/lib/github_cli/commands/labels.rb +0 -20
  34. data/lib/github_cli/commands/members.rb +0 -10
  35. data/lib/github_cli/commands/milestones.rb +0 -10
  36. data/lib/github_cli/commands/organizations.rb +0 -6
  37. data/lib/github_cli/commands/pull_requests.rb +0 -16
  38. data/lib/github_cli/commands/references.rb +0 -10
  39. data/lib/github_cli/commands/repositories.rb +0 -18
  40. data/lib/github_cli/commands/search.rb +39 -0
  41. data/lib/github_cli/commands/tags.rb +0 -4
  42. data/lib/github_cli/commands/teams.rb +0 -26
  43. data/lib/github_cli/commands/trees.rb +0 -4
  44. data/lib/github_cli/commands/users.rb +0 -4
  45. data/lib/github_cli/commands/watching.rb +0 -10
  46. data/lib/github_cli/subcommands.rb +6 -0
  47. data/lib/github_cli/version.rb +1 -1
  48. metadata +32 -12
@@ -6,15 +6,11 @@ module GithubCLI
6
6
  namespace :download
7
7
 
8
8
  desc 'list <user> <repo>', 'Lists downloads'
9
- method_option :params, :type => :hash, :default => {},
10
- :desc => 'Additional request parameters e.i per_page:100'
11
9
  def list(user, repo)
12
10
  Download.all user, repo, options[:params], options[:format]
13
11
  end
14
12
 
15
13
  desc 'get <user> <repo> <id>', 'Get a download'
16
- method_option :params, :type => :hash, :default => {},
17
- :desc => 'Additional request parameters e.i per_page:100'
18
14
  def get(user, repo, id)
19
15
  Download.get user, repo, id, options[:params], options[:format]
20
16
  end
@@ -33,8 +29,6 @@ module GithubCLI
33
29
  description - Optional string \n
34
30
  content_type - Optional string \n
35
31
  DESC
36
- method_option :params, :type => :hash, :default => {},
37
- :desc => 'Additonal request parameters e.i per_page:100'
38
32
  def create(user, repo)
39
33
  Download.create user, repo, options[:params], options[:format]
40
34
  end
@@ -57,8 +51,6 @@ module GithubCLI
57
51
  end
58
52
 
59
53
  desc 'delete <user> <repo> <id>', 'Delete a download'
60
- method_option :params, :type => :hash, :default => {},
61
- :desc => 'Additonal request parameters e.i per_page:100'
62
54
  def delete(user, repo, id)
63
55
  Download.delete user, repo, id, options[:params], options[:format]
64
56
  end
@@ -6,8 +6,6 @@ module GithubCLI
6
6
  namespace :email
7
7
 
8
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
9
  def list()
12
10
  Email.all options[:params], options[:format]
13
11
  end
@@ -16,8 +14,6 @@ module GithubCLI
16
14
  long_desc <<-DESC
17
15
  You can include a single email address or an array of addresses
18
16
  DESC
19
- method_option :params, :type => :hash, :default => {},
20
- :desc => 'Additonal request parameters e.i per_page:100'
21
17
  def add(*emails)
22
18
  Email.add emails, options[:params], options[:format]
23
19
  end
@@ -26,8 +22,6 @@ module GithubCLI
26
22
  long_desc <<-DESC
27
23
  You can include a single email address or an array of addresses
28
24
  DESC
29
- method_option :params, :type => :hash, :default => {},
30
- :desc => 'Additonal request parameters e.i per_page:100'
31
25
  def delete(*emails)
32
26
  Email.delete emails, options[:params], options[:format]
33
27
  end
@@ -6,36 +6,26 @@ module GithubCLI
6
6
  namespace :event
7
7
 
8
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
9
  def public
12
10
  Event.public options[:params], options[:format]
13
11
  end
14
12
 
15
13
  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
14
  def repo(user, repo)
19
15
  Event.repository user, repo, options[:params], options[:format]
20
16
  end
21
17
 
22
18
  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
19
  def issue(user, repo)
26
20
  Event.issue user, repo, options[:params], options[:format]
27
21
  end
28
22
 
29
23
  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
24
  def network(user, repo)
33
25
  Event.network user, repo, options[:params], options[:format]
34
26
  end
35
27
 
36
28
  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
29
  def org(org)
40
30
  Event.organization org, options[:params], options[:format]
41
31
  end
@@ -43,8 +33,6 @@ module GithubCLI
43
33
  desc 'received <user>', 'Lists all events that a user has received'
44
34
  method_option :public, :type => :boolean,
45
35
  :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
36
  long_desc <<-DESC
49
37
  These are events that you’ve received by watching repos and following users.
50
38
  If you are authenticated as the given user, you will see private events.
@@ -60,8 +48,6 @@ module GithubCLI
60
48
  desc 'performed <user>', 'Lists all events that a user has performed'
61
49
  method_option :public, :type => :boolean,
62
50
  :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
51
  long_desc <<-DESC
66
52
  If you are authenticated as the given user, you will see your private
67
53
  events. Otherwise, you’ll only see public events.
@@ -74,8 +60,6 @@ module GithubCLI
74
60
  end
75
61
 
76
62
  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
63
  long_desc <<-DESC
80
64
  This is the user’s organization dashboard. You must be authenticated
81
65
  as the user to view this.
@@ -9,8 +9,6 @@ module GithubCLI
9
9
  method_option :user, :type => :string, :aliases => ["-u"],
10
10
  :desc => 'List a <user> followers',
11
11
  :banner => '<user>'
12
- method_option :params, :type => :hash, :default => {},
13
- :desc => 'Additional request parameters e.i per_page:100'
14
12
  def list
15
13
  Follower.all options[:user], options[:params], options[:format]
16
14
  end
@@ -19,29 +17,21 @@ module GithubCLI
19
17
  method_option :user, :type => :string, :aliases => ["-u"],
20
18
  :desc => 'List who a <user> is following',
21
19
  :banner => '<user>'
22
- method_option :params, :type => :hash, :default => {},
23
- :desc => 'Additional request parameters e.i per_page:100'
24
20
  def following
25
21
  Follower.following options[:user], options[:params], options[:format]
26
22
  end
27
23
 
28
24
  desc 'follower <user>', 'Check if you are following a user'
29
- method_option :params, :type => :hash, :default => {},
30
- :desc => 'Additional request parameters e.i per_page:100'
31
25
  def follower(user)
32
26
  Follower.following? user, options[:params], options[:format]
33
27
  end
34
28
 
35
29
  desc 'follow <user>', 'Follow a user'
36
- method_option :params, :type => :hash, :default => {},
37
- :desc => 'Additional request parameters e.i per_page:100'
38
30
  def follow(user)
39
31
  Follower.follow user, options[:params], options[:format]
40
32
  end
41
33
 
42
34
  desc 'unfollow <user>', 'Unfollow a user'
43
- method_option :params, :type => :hash, :default => {},
44
- :desc => 'Additional request parameters e.i per_page:100'
45
35
  def unfollow(user)
46
36
  Follower.unfollow user, options[:params], options[:format]
47
37
  end
@@ -16,8 +16,6 @@ module GithubCLI
16
16
  method_option :sort, :type => :string, :aliases => ["-s"],
17
17
  :desc => 'Sort by newest, oldest or watchers',
18
18
  :banner => '<sort-category>'
19
- method_option :params, :type => :hash, :default => {},
20
- :desc => 'Additional request parameters e.i per_page:100'
21
19
  def list(user, repo)
22
20
  if options[:sort]
23
21
  options[:params]['sort'] = options[:sort]
@@ -28,8 +26,6 @@ module GithubCLI
28
26
  desc 'create <user> <repo>', 'Create a new fork'
29
27
  method_option :org, :type => :string,
30
28
  :desc => ' Organization login. The repository will be forked into this organization.'
31
- method_option :params, :type => :hash, :default => {},
32
- :desc => 'Additonal request parameters e.i per_page:100'
33
29
  def create(user, repo)
34
30
  if options[:org]
35
31
  options[:params]['org'] = options[:org]
@@ -12,8 +12,6 @@ module GithubCLI
12
12
  method_option :starred, :type => :boolean, :aliases => ["-s"],
13
13
  :default => false,
14
14
  :desc => 'List the authenticated users starred gists'
15
- method_option :params, :type => :hash, :default => {},
16
- :desc => 'Additonal request parameters e.i per_page:100'
17
15
  def list
18
16
  Gist.starred if options[:starred]
19
17
 
@@ -24,15 +22,11 @@ module GithubCLI
24
22
  end
25
23
 
26
24
  desc 'get <id>', 'Get a single gist'
27
- method_option :params, :type => :hash, :default => {},
28
- :desc => 'Additonal request parameters e.i per_page:100'
29
25
  def get(id)
30
26
  Gist.get id, options[:params], options[:format]
31
27
  end
32
28
 
33
29
  desc 'create', 'Create a gist'
34
- method_option :params, :type => :hash, :default => {},
35
- :desc => 'Additonal request parameters e.i per_page:100'
36
30
  long_desc <<-DESC
37
31
  Create a gist
38
32
 
@@ -48,8 +42,6 @@ module GithubCLI
48
42
  end
49
43
 
50
44
  desc 'edit <id>', 'Edit a gist'
51
- method_option :params, :type => :hash, :default => {},
52
- :desc => 'Additonal request parameters e.i per_page:100'
53
45
  long_desc <<-DESC
54
46
  Edit a gist
55
47
 
@@ -65,36 +57,26 @@ module GithubCLI
65
57
  end
66
58
 
67
59
  desc 'star <id>', 'Star a gist'
68
- method_option :params, :type => :hash, :default => {},
69
- :desc => 'Additonal request parameters e.i per_page:100'
70
60
  def star(id)
71
61
  Gist.star id, options[:params], options[:format]
72
62
  end
73
63
 
74
64
  desc 'unstar <id>', 'Unstar a gist'
75
- method_option :params, :type => :hash, :default => {},
76
- :desc => 'Additonal request parameters e.i per_page:100'
77
65
  def unstar(id)
78
66
  Gist.unstar id, options[:params], options[:format]
79
67
  end
80
68
 
81
69
  desc 'starred <id>', 'Check if a gist is starred'
82
- method_option :params, :type => :hash, :default => {},
83
- :desc => 'Additonal request parameters e.i per_page:100'
84
70
  def starred(id)
85
71
  Gist.starred? id, options[:params], options[:format]
86
72
  end
87
73
 
88
74
  desc 'fork <id>', 'Fork a gist'
89
- method_option :params, :type => :hash, :default => {},
90
- :desc => 'Additonal request parameters e.i per_page:100'
91
75
  def fork(id)
92
76
  Gist.fork id, options[:params], options[:format]
93
77
  end
94
78
 
95
79
  desc 'delete <id>', 'Delete a gist'
96
- method_option :params, :type => :hash, :default => {},
97
- :desc => 'Additonal request parameters e.i per_page:100'
98
80
  def delete(id)
99
81
  Gist.delete id, options[:params], options[:format]
100
82
  end
@@ -6,15 +6,11 @@ module GithubCLI
6
6
  namespace :hook
7
7
 
8
8
  desc 'list <user> <repo>', 'Lists hooks'
9
- method_option :params, :type => :hash, :default => {},
10
- :desc => 'Additional request parameters e.i per_page:100'
11
9
  def list(user, repo)
12
10
  Hook.all user, repo, options[:params], options[:format]
13
11
  end
14
12
 
15
13
  desc 'get <user> <repo> <id>', 'Get a hook'
16
- method_option :params, :type => :hash, :default => {},
17
- :desc => 'Additional request parameters e.i per_page:100'
18
14
  def get(user, repo, id)
19
15
  Hook.get user, repo, id, options[:params], options[:format]
20
16
  end
@@ -28,8 +24,6 @@ module GithubCLI
28
24
  events - Optional array - Determines what events the hook is triggered for. Default: ["push"] \n
29
25
  active - Optional boolean - Determines whether the hook is actually triggered on pushes.
30
26
  DESC
31
- method_option :params, :type => :hash, :default => {},
32
- :desc => 'Additonal request parameters e.i per_page:100'
33
27
  def create(user, repo)
34
28
  Hook.create user, repo, options[:params], options[:format]
35
29
  end
@@ -50,15 +44,11 @@ module GithubCLI
50
44
  end
51
45
 
52
46
  desc 'test <user> <repo> <id>', 'Test a hook'
53
- method_option :params, :type => :hash, :default => {},
54
- :desc => 'Additonal request parameters e.i per_page:100'
55
47
  def test(user, repo, id)
56
48
  Hook.test user, repo, id, options[:params], options[:format]
57
49
  end
58
50
 
59
51
  desc 'delete <user> <repo> <id>', 'Delete a hook'
60
- method_option :params, :type => :hash, :default => {},
61
- :desc => 'Additonal request parameters e.i per_page:100'
62
52
  def delete(user, repo, id)
63
53
  Hook.delete user, repo, id, options[:params], options[:format]
64
54
  end
@@ -22,8 +22,6 @@ module GithubCLI
22
22
  direction - asc, desc, default: desc \n
23
23
  since - Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ \n
24
24
  DESC
25
- method_option :params, :type => :hash, :default => {}, :aliases => '-p',
26
- :desc => 'Additonal request parameters e.i per_page:100'
27
25
  def list
28
26
  Issue.all options[:params], options[:format]
29
27
  end
@@ -47,15 +45,11 @@ module GithubCLI
47
45
  direction - asc, desc, default: desc\n
48
46
  since - Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ\n
49
47
  DESC
50
- method_option :params, :type => :hash, :default => {}, :aliases => '-p',
51
- :desc => 'Additonal request parameters e.i per_page:100'
52
48
  def repo(user, repo)
53
49
  Issue.all user, repo, options[:params], options[:format]
54
50
  end
55
51
 
56
52
  desc 'get <user> <repo> <id>', 'Get a single issue'
57
- method_option :params, :type => :hash, :default => {}, :aliases => '-p',
58
- :desc => 'Additonal request parameters e.i per_page:100'
59
53
  def get(user, repo, id)
60
54
  Issue.get user, repo, id, options[:params], options[:format]
61
55
  end
@@ -70,8 +64,6 @@ module GithubCLI
70
64
  milestone - Optional number - Milestone to associate this issue with\n
71
65
  labels - Optional array of strings - Labels to associate with this issue
72
66
  DESC
73
- method_option :params, :type => :hash, :default => {}, :aliases => '-p',
74
- :desc => 'Additonal request parameters e.i per_page:100'
75
67
  def create(user, repo)
76
68
  Issue.create user, repo, options[:params], options[:format]
77
69
  end
@@ -87,8 +79,6 @@ module GithubCLI
87
79
  milestone - Optional number - Milestone to associate this issue with\n
88
80
  labels - Optional array of strings - Labels to associate with this issue
89
81
  DESC
90
- method_option :params, :type => :hash, :default => {}, :aliases => '-p',
91
- :desc => 'Additonal request parameters e.i per_page:100'
92
82
  def edit(user, repo, id)
93
83
  Issue.edit user, repo, id, options[:params], options[:format]
94
84
  end
@@ -6,15 +6,11 @@ module GithubCLI
6
6
  namespace :key
7
7
 
8
8
  desc 'list <user> <repo>', 'Lists keys'
9
- method_option :params, :type => :hash, :default => {},
10
- :desc => 'Additional request parameters e.i per_page:100'
11
9
  def list(user, repo)
12
10
  Key.all user, repo, options[:params], options[:format]
13
11
  end
14
12
 
15
13
  desc 'get <user> <repo> <id>', 'Get a key'
16
- method_option :params, :type => :hash, :default => {},
17
- :desc => 'Additional request parameters e.i per_page:100'
18
14
  def get(user, repo, id)
19
15
  Key.get user, repo, id, options[:params], options[:format]
20
16
  end
@@ -26,8 +22,6 @@ module GithubCLI
26
22
  title - Required string. \n
27
23
  key - Required string.
28
24
  DESC
29
- method_option :params, :type => :hash, :default => {},
30
- :desc => 'Additonal request parameters e.i per_page:100'
31
25
  def create(user, repo)
32
26
  Key.create user, repo, options[:params], options[:format]
33
27
  end
@@ -39,15 +33,11 @@ module GithubCLI
39
33
  title - Required string. \n
40
34
  key - Required string.
41
35
  DESC
42
- method_option :params, :type => :hash, :default => {},
43
- :desc => 'Additonal request parameters e.i per_page:100'
44
36
  def edit(user, repo, id)
45
37
  Key.edit user, repo, id, options[:params], options[:format]
46
38
  end
47
39
 
48
40
  desc 'delete <user> <repo> <id>', 'Delete a key'
49
- method_option :params, :type => :hash, :default => {},
50
- :desc => 'Additonal request parameters e.i per_page:100'
51
41
  def delete(user, repo, id)
52
42
  Key.delete user, repo, id, options[:params], options[:format]
53
43
  end
@@ -6,15 +6,11 @@ module GithubCLI
6
6
  namespace :label
7
7
 
8
8
  desc 'list <user> <repo>', 'Listing all labels for this repository.'
9
- method_option :params, :type => :hash, :default => {},
10
- :desc => 'Additonal request parameters e.i per_page:100'
11
9
  def list(user, repo)
12
10
  Label.all user, repo, options[:params], options[:format]
13
11
  end
14
12
 
15
13
  desc 'get <user> <repo> <name>', 'Get a single label.'
16
- method_option :params, :type => :hash, :default => {},
17
- :desc => 'Additonal request parameters e.i per_page:100'
18
14
  def get(user, repo, name)
19
15
  Label.get user, repo, name, options[:params], options[:format]
20
16
  end
@@ -25,29 +21,21 @@ module GithubCLI
25
21
  name - Required string
26
22
  color - Required string - 6 character hex code, without leading #
27
23
  DESC
28
- method_option :params, :type => :hash, :default => {},
29
- :desc => 'Additonal request parameters e.i per_page:100'
30
24
  def create(user, repo)
31
25
  Label.create user, repo, options[:params], options[:format]
32
26
  end
33
27
 
34
28
  desc 'update <user> <repo> <name>', 'Update a label.'
35
- method_option :params, :type => :hash, :default => {},
36
- :desc => 'Additonal request parameters e.i per_page:100'
37
29
  def update(user, repo, name)
38
30
  Label.update user, repo, name, options[:params], options[:format]
39
31
  end
40
32
 
41
33
  desc 'delete <user> <repo> <name>', 'Delete a label.'
42
- method_option :params, :type => :hash, :default => {},
43
- :desc => 'Additonal request parameters e.i per_page:100'
44
34
  def delete(user, repo, name)
45
35
  Label.delete user, repo, name, options[:params], options[:format]
46
36
  end
47
37
 
48
38
  desc 'issue <user> <repo> <number>', 'List labels on an issue.'
49
- method_option :params, :type => :hash, :default => {},
50
- :desc => 'Additonal request parameters e.i per_page:100'
51
39
  def issue(user, repo, number)
52
40
  Label.issue user, repo, number, options[:params], options[:format]
53
41
  end
@@ -55,8 +43,6 @@ module GithubCLI
55
43
  desc 'add <user> <repo> <number>', 'Add labels to an issue.'
56
44
  method_option :labels, :type => :string,
57
45
  :desc => 'Labels to be added to this issue.'
58
- method_option :params, :type => :hash, :default => {},
59
- :desc => 'Additional request parameters e.i per_page:100'
60
46
  def add(user, repo, number)
61
47
  Label.add user, repo, number, options[:labels], options[:params]
62
48
  end
@@ -64,8 +50,6 @@ module GithubCLI
64
50
  desc 'remove <user> <repo> <number>', 'List labels on an issue.'
65
51
  method_option :name, :type => :string, :default => nil,
66
52
  :desc => 'Label name'
67
- method_option :params, :type => :hash, :default => {},
68
- :desc => 'Additonal request parameters e.i per_page:100'
69
53
  def remove(user, repo, number)
70
54
  Label.issue user, repo, number, options[:name], options[:params], options[:format]
71
55
  end
@@ -73,15 +57,11 @@ module GithubCLI
73
57
  desc 'replace <user> <repo> <number>', 'Replace all labels for an issue.'
74
58
  method_option :labels, :type => :string,
75
59
  :desc => 'Labels to be replace in this issue.'
76
- method_option :params, :type => :hash, :default => {},
77
- :desc => 'Additonal request parameters e.i per_page:100'
78
60
  def replace(user, repo, number)
79
61
  Label.replace user, repo, number, options[:labels], options[:params]
80
62
  end
81
63
 
82
64
  desc 'milestone <user> <repo> <number>', 'Get labels for every issue in a milestone.'
83
- method_option :params, :type => :hash, :default => {},
84
- :desc => 'Additonal request parameters e.i per_page:100'
85
65
  def milestone(user, repo, number)
86
66
  Label.milestone user, repo, number, options[:params], options[:format]
87
67
  end