octokitty 1.1.0 → 1.2.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/octokitty +5 -4
  3. data/octokitty.gemspec +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c46dae84417725fe4566c4d00781c6ae7fe7bde
4
- data.tar.gz: 9ee41febf5836ca2534bce9d2b88960c3f8877da
3
+ metadata.gz: c7f6b03ab25315b66d56cfc7ff794f35a990b69a
4
+ data.tar.gz: 79b4de898368d44df0d31f067bf6c04d6d19721c
5
5
  SHA512:
6
- metadata.gz: be7a81660d7ddd8a123eb958843bea76516ada0ad3b899723ab2573451882fe26c06fddc581783bbb92f2cc3657728bbfe65a1464e2b407422ed341bba6be2f3
7
- data.tar.gz: cea1b4b57efed998672ba2f13d693488e50d648bc0bdee2108814b0017919b07ff238c897f0be93cdd75a22aca06e21a8bf4a4398a40bcad78b83e90dc9ba027
6
+ metadata.gz: f7d5d69991105e7e841687c32b53b0da45372b0ce7b5041d48236d0f423a52f1445ab77bcf7c199d55859e759b518e00318feee5465058ab4a2a710086a07430
7
+ data.tar.gz: ca849d8c0e6a7230a6711771ea96a3f0a5c3f376a4f19aba7f0ceb13224bec4d522f46ef5047fc2a6ae70730df50b30d046f50e4cb6f94e55a49df54b824ed82
@@ -7,7 +7,7 @@ github = Octokit::Client.new auto_paginate: true, access_token: ENV.fetch('GITHU
7
7
  command = File.basename($0).gsub('-', '_')
8
8
 
9
9
  if command == 'octokitty'
10
- if ARGV.empty?
10
+ if ARGV.empty? || (ARGV.first == '--help')
11
11
  puts 'usage: octokitty <function>'
12
12
  exit false
13
13
  else
@@ -20,13 +20,14 @@ if command == 'octokitty'
20
20
  end
21
21
 
22
22
  required, optional = github.method(command).parameters.partition { |p,_| p == :req }.map { |l| l.flat_map { |p| p.last } }
23
- arguments = ARGV.shift(required.length)
24
- options = ARGV.select { |a| a.start_with? '--' }.map{ |a| a[2..-1].to_sym }.zip(ARGV.reject { |a| a.start_with? '--' }).to_h
25
23
 
26
- if arguments.length < required.length
24
+ if (ARGV.first == '--help') || (ARGV.length < required.length)
27
25
  printf "usage: %s %s %s\n", command, required.map { |r| "<#{r}>" }.join(' '), optional.map { |o| "[#{o}]" }.join(' ')
28
26
  exit false
29
27
  end
30
28
 
29
+ arguments = ARGV.shift(required.length)
30
+ options = ARGV.select { |a| a.start_with? '--' }.map{ |a| a[2..-1].to_sym }.zip(ARGV.reject { |a| a.start_with? '--' }).to_h
31
+
31
32
  response = github.method(command).call(*arguments, options)
32
33
  puts JSON.dump(response.class == Sawyer::Resource ? response.to_h : response.map(&:to_h))
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'octokitty'
3
- gem.version = '1.1.0'
3
+ gem.version = '1.2.0'
4
4
  gem.licenses = 'MIT'
5
5
  gem.authors = ['Chris Olstrom']
6
6
  gem.email = 'chris@olstrom.com'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octokitty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Olstrom