githuh 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.envrc +3 -3
- data/.github/workflows/ruby.yml +2 -2
- data/.gitignore +2 -0
- data/.rubocop_todo.yml +11 -27
- data/Gemfile.lock +13 -16
- data/README.adoc +16 -0
- data/config/label-mapping.yml +12 -0
- data/docs/img/coverage.svg +3 -3
- data/githuh.gemspec +1 -0
- data/lib/githuh/cli/commands/base.rb +24 -14
- data/lib/githuh/cli/commands/issue/export.rb +56 -55
- data/lib/githuh/cli/commands/repo/list.rb +3 -1
- data/lib/githuh/cli/commands/user/info.rb +1 -1
- data/lib/githuh/cli/launcher.rb +4 -1
- data/lib/githuh/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b85ccd845fbf4f02072b566abd362adc5656eff6746c092ee1591011c69da0ab
|
4
|
+
data.tar.gz: 7becd01e22f79e9a6c79dcb9292f5003d48a4fc57596c9ace415d1bff44f8e6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d425dec858b7587d373b30a8c1dbdeddcdfda625230e32a0cc49ec9d4a28574c164d2330a01ff77c69f5bb57c164aa7c3b6cedfb37e27506dce28910eb176442
|
7
|
+
data.tar.gz: dba51e9fa2685db0978cdb051801ec573f97fd43f740c28fea5250afba8b7e121e265d3f962ca5466a4138eb43344bd81c99558f5a7f7c7859323d2c7f916c84
|
data/.envrc
CHANGED
data/.github/workflows/ruby.yml
CHANGED
data/.gitignore
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2020-09-
|
3
|
+
# on 2020-09-11 02:48:55 UTC using RuboCop version 0.90.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -35,7 +35,7 @@ Layout/EndAlignment:
|
|
35
35
|
- 'lib/githuh/cli/commands/issue/export.rb'
|
36
36
|
- 'lib/githuh/cli/commands/repo/list.rb'
|
37
37
|
|
38
|
-
# Offense count:
|
38
|
+
# Offense count: 1
|
39
39
|
# Cop supports --auto-correct.
|
40
40
|
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
41
41
|
# SupportedHashRocketStyles: key, separator, table
|
@@ -52,22 +52,6 @@ Layout/IndentationWidth:
|
|
52
52
|
Exclude:
|
53
53
|
- 'lib/githuh/cli/commands/issue/export.rb'
|
54
54
|
|
55
|
-
# Offense count: 1
|
56
|
-
# Cop supports --auto-correct.
|
57
|
-
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
58
|
-
# SupportedStyles: aligned, indented
|
59
|
-
Layout/MultilineOperationIndentation:
|
60
|
-
Exclude:
|
61
|
-
- 'lib/githuh/cli/commands/issue/export.rb'
|
62
|
-
|
63
|
-
# Offense count: 1
|
64
|
-
# Cop supports --auto-correct.
|
65
|
-
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
66
|
-
# SupportedStylesForExponentOperator: space, no_space
|
67
|
-
Layout/SpaceAroundOperators:
|
68
|
-
Exclude:
|
69
|
-
- 'lib/githuh/cli/commands/issue/export.rb'
|
70
|
-
|
71
55
|
# Offense count: 1
|
72
56
|
# Cop supports --auto-correct.
|
73
57
|
# Configuration parameters: EnforcedStyle.
|
@@ -82,6 +66,13 @@ Lint/NonDeterministicRequireOrder:
|
|
82
66
|
Exclude:
|
83
67
|
- 'spec/spec_helper.rb'
|
84
68
|
|
69
|
+
# Offense count: 1
|
70
|
+
# Configuration parameters: AllowedMethods.
|
71
|
+
# AllowedMethods: present?, blank?, presence, try, try!
|
72
|
+
Lint/SafeNavigationChain:
|
73
|
+
Exclude:
|
74
|
+
- 'lib/githuh/cli/commands/repo/list.rb'
|
75
|
+
|
85
76
|
# Offense count: 1
|
86
77
|
# Cop supports --auto-correct.
|
87
78
|
Lint/ScriptPermission:
|
@@ -100,16 +91,9 @@ Style/ExpandPathArguments:
|
|
100
91
|
Style/FormatStringToken:
|
101
92
|
EnforcedStyle: unannotated
|
102
93
|
|
103
|
-
# Offense count:
|
104
|
-
# Cop supports --auto-correct.
|
105
|
-
# Configuration parameters: EnforcedStyle.
|
106
|
-
# SupportedStyles: always, always_true, never
|
107
|
-
Style/FrozenStringLiteralComment:
|
108
|
-
Exclude:
|
109
|
-
- 'lib/githuh/cli/commands/issue/export_paginated.rb'
|
110
|
-
|
111
|
-
# Offense count: 1
|
94
|
+
# Offense count: 2
|
112
95
|
# Configuration parameters: MinBodyLength.
|
113
96
|
Style/GuardClause:
|
114
97
|
Exclude:
|
98
|
+
- 'lib/githuh/cli/commands/base.rb'
|
115
99
|
- 'lib/githuh/cli/launcher.rb'
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
githuh (0.
|
4
|
+
githuh (0.3.0)
|
5
5
|
activesupport
|
6
6
|
colored2 (~> 3)
|
7
7
|
dry-cli (~> 0.6)
|
8
|
+
hashie
|
8
9
|
octokit (~> 4)
|
9
10
|
tty-box
|
10
11
|
tty-progressbar
|
@@ -56,11 +57,11 @@ GEM
|
|
56
57
|
docile (1.3.2)
|
57
58
|
dry-cli (0.6.0)
|
58
59
|
concurrent-ruby (~> 1.0)
|
59
|
-
equatable (0.6.1)
|
60
60
|
faraday (1.0.1)
|
61
61
|
multipart-post (>= 1.2, < 3)
|
62
62
|
ffi (1.13.1)
|
63
63
|
gherkin (5.1.0)
|
64
|
+
hashie (4.1.0)
|
64
65
|
i18n (1.8.5)
|
65
66
|
concurrent-ruby (~> 1.0)
|
66
67
|
minitest (5.14.2)
|
@@ -73,8 +74,7 @@ GEM
|
|
73
74
|
parallel (1.19.2)
|
74
75
|
parser (2.7.1.4)
|
75
76
|
ast (~> 2.4.1)
|
76
|
-
pastel (0.
|
77
|
-
equatable (~> 0.6)
|
77
|
+
pastel (0.8.0)
|
78
78
|
tty-color (~> 0.5)
|
79
79
|
public_suffix (4.0.6)
|
80
80
|
rainbow (3.0.0)
|
@@ -117,25 +117,22 @@ GEM
|
|
117
117
|
simplecov-html (~> 0.11)
|
118
118
|
simplecov-formatter-badge (0.1.0)
|
119
119
|
simplecov-html (0.12.2)
|
120
|
-
strings (0.
|
121
|
-
strings-ansi (~> 0.
|
120
|
+
strings (0.2.0)
|
121
|
+
strings-ansi (~> 0.2)
|
122
122
|
unicode-display_width (~> 1.5)
|
123
123
|
unicode_utils (~> 1.4)
|
124
|
-
strings-ansi (0.
|
124
|
+
strings-ansi (0.2.0)
|
125
125
|
thor (1.0.1)
|
126
126
|
thread_safe (0.3.6)
|
127
|
-
tty-box (0.
|
128
|
-
pastel (~> 0.
|
129
|
-
strings (~> 0.
|
127
|
+
tty-box (0.6.0)
|
128
|
+
pastel (~> 0.8)
|
129
|
+
strings (~> 0.2.0)
|
130
130
|
tty-cursor (~> 0.7)
|
131
131
|
tty-color (0.5.2)
|
132
132
|
tty-cursor (0.7.1)
|
133
|
-
tty-progressbar (0.
|
134
|
-
|
135
|
-
|
136
|
-
tty-screen (~> 0.7)
|
137
|
-
unicode-display_width (~> 1.6)
|
138
|
-
tty-screen (0.8.1)
|
133
|
+
tty-progressbar (0.11.0)
|
134
|
+
tty-screen (~> 0.5.0)
|
135
|
+
tty-screen (0.5.1)
|
139
136
|
tzinfo (1.2.7)
|
140
137
|
thread_safe (~> 0.1)
|
141
138
|
unicode-display_width (1.7.0)
|
data/README.adoc
CHANGED
@@ -75,9 +75,25 @@ Options:
|
|
75
75
|
--[no-]verbose # Print additional debugging info, default: false
|
76
76
|
--file=VALUE # Output file, overrides <username>.<repo>.issues.<format>
|
77
77
|
--format=VALUE # Output format: (json/csv), default: "csv"
|
78
|
+
--mapping=VALUE # YAML file with label to estimates mapping
|
78
79
|
--help, -h # Print this help
|
79
80
|
----
|
80
81
|
|
82
|
+
==== Label Mappings
|
83
|
+
|
84
|
+
The export suppots a configurable mapping of Github labels to Pivotal Tracker points. To use this feature, create a YAML file similar to the xref:config/label-mapping.yml[config/label-mapping.yml] provided:
|
85
|
+
|
86
|
+
[source,yaml]
|
87
|
+
----
|
88
|
+
---
|
89
|
+
label-to-estimates:
|
90
|
+
Large: 5
|
91
|
+
Medium: 3
|
92
|
+
Small: 1
|
93
|
+
----
|
94
|
+
|
95
|
+
Then add `--mapping=<filename>` argument to the export command.
|
96
|
+
|
81
97
|
==== Example
|
82
98
|
|
83
99
|
Eg, to export all issues of this repo into Pivotal Tracker compatibel CSV:
|
data/docs/img/coverage.svg
CHANGED
@@ -8,10 +8,10 @@
|
|
8
8
|
<rect rx="5" width="130" height="20" fill="url(#a)"/>
|
9
9
|
<rect rx="5" x="80" width="50" height="20" fill="#4BAF00"/>
|
10
10
|
<rect rx="5" x="80" width="50" height="20" fill="url(#a)"/>
|
11
|
-
<g fill="#fff" text-anchor="middle" font-weight="
|
11
|
+
<g fill="#fff" text-anchor="middle" font-weight="500" font-family="Consolas,DejaVu Sans,Verdana,Geneva,sans-serif" font-size="10">
|
12
12
|
<text x="40.5" y="15" fill="#010101" fill-opacity=".3">COVERAGE</text>
|
13
13
|
<text x="41.5" y="14">COVERAGE</text>
|
14
|
-
<text x="105.5" y="15" fill="#010101" fill-opacity=".3">
|
15
|
-
<text x="106.5" y="14">
|
14
|
+
<text x="105.5" y="15" fill="#010101" fill-opacity=".3">68%</text>
|
15
|
+
<text x="106.5" y="14">68%</text>
|
16
16
|
</g>
|
17
17
|
</svg>
|
data/githuh.gemspec
CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency 'activesupport'
|
28
28
|
spec.add_dependency 'colored2', '~> 3'
|
29
29
|
spec.add_dependency 'dry-cli', '~> 0.6'
|
30
|
+
spec.add_dependency 'hashie'
|
30
31
|
spec.add_dependency 'octokit', '~> 4'
|
31
32
|
spec.add_dependency 'tty-box'
|
32
33
|
spec.add_dependency 'tty-progressbar'
|
@@ -28,7 +28,7 @@ module Githuh
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
attr_accessor :
|
31
|
+
attr_accessor :token, :per_page, :verbose, :info, :box, :context
|
32
32
|
|
33
33
|
def call(api_token: nil,
|
34
34
|
per_page: DEFAULT_PAGE_SIZE,
|
@@ -38,11 +38,20 @@ module Githuh
|
|
38
38
|
self.context = Githuh
|
39
39
|
self.verbose = verbose
|
40
40
|
self.info = info
|
41
|
-
self.token = api_token ||
|
41
|
+
self.token = api_token || determine_github_token
|
42
42
|
self.per_page = per_page.to_i || DEFAULT_PAGE_SIZE
|
43
|
-
self.client = Octokit::Client.new(access_token: token)
|
44
43
|
|
45
|
-
|
44
|
+
if info
|
45
|
+
begin
|
46
|
+
print_userinfo
|
47
|
+
rescue StandardError
|
48
|
+
nil
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def client
|
54
|
+
@client ||= Octokit::Client.new(access_token: token)
|
46
55
|
end
|
47
56
|
|
48
57
|
protected
|
@@ -83,6 +92,17 @@ module Githuh
|
|
83
92
|
complete: '▉'.magenta)
|
84
93
|
end
|
85
94
|
|
95
|
+
def determine_github_token
|
96
|
+
@github_token ||= (ENV['GITHUB_TOKEN'] || `git config --global --get user.token`.chomp)
|
97
|
+
|
98
|
+
return @github_token unless @github_token.empty?
|
99
|
+
|
100
|
+
raise "No token was found in your ~/.gitconfig.\n" \
|
101
|
+
"To add, run the following command: \n" \
|
102
|
+
"git config --global --set user.token YOUR_GITHUB_TOKEN\n" \
|
103
|
+
"or set environment variable GITHUB_TOKEN"
|
104
|
+
end
|
105
|
+
|
86
106
|
private
|
87
107
|
|
88
108
|
def print_userinfo
|
@@ -116,16 +136,6 @@ module Githuh
|
|
116
136
|
def h(arg)
|
117
137
|
arg.to_s
|
118
138
|
end
|
119
|
-
|
120
|
-
def token_from_gitconfig
|
121
|
-
@token_from_gitconfig ||= `git config --global --get user.token`.chomp
|
122
|
-
|
123
|
-
return @token_from_gitconfig unless @token_from_gitconfig.empty?
|
124
|
-
|
125
|
-
raise "No token was found in your ~/.gitconfig.\n" \
|
126
|
-
"To add, run the following command: \n" \
|
127
|
-
"git config --global --set user.token YOUR_GITHUB_TOKEN"
|
128
|
-
end
|
129
139
|
end
|
130
140
|
end
|
131
141
|
end
|
@@ -2,14 +2,15 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# vim: ft=ruby
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
5
|
+
require "bundler/setup"
|
6
|
+
require "dry/cli"
|
7
|
+
require "json"
|
8
|
+
require "tty/progressbar"
|
9
|
+
require "csv"
|
10
|
+
require "active_support/inflector"
|
11
|
+
require "yaml"
|
11
12
|
|
12
|
-
require_relative
|
13
|
+
require_relative "../base"
|
13
14
|
|
14
15
|
module Githuh
|
15
16
|
module CLI
|
@@ -17,40 +18,50 @@ module Githuh
|
|
17
18
|
module Issue
|
18
19
|
class Export < Base
|
19
20
|
FORMATS = {
|
20
|
-
json:
|
21
|
-
csv:
|
21
|
+
json: "json",
|
22
|
+
csv: "csv",
|
22
23
|
}.freeze
|
23
24
|
|
24
|
-
DEFAULT_FORMAT
|
25
|
+
DEFAULT_FORMAT = :csv
|
25
26
|
DEFAULT_OUTPUT_FORMAT = "<username>.<repo>.issues.<format>"
|
26
27
|
|
27
|
-
attr_accessor :filename, :file, :output, :repo, :issues, :format, :record_count
|
28
|
+
attr_accessor :filename, :file, :output, :repo, :issues, :format, :record_count, :mapping
|
28
29
|
|
29
30
|
desc "Export Repo issues into a CSV or JSON format\n" \
|
30
31
|
" Default output file is " + DEFAULT_OUTPUT_FORMAT.bold.yellow
|
31
32
|
|
32
33
|
argument :repo, type: :string, required: true, desc: 'Name of the repo, eg "rails/rails"'
|
33
|
-
option :file, required: false, desc:
|
34
|
-
option :format, values: FORMATS.keys.map(&:to_s), default: DEFAULT_FORMAT.to_s, required: false, desc:
|
34
|
+
option :file, required: false, desc: "Output file, overrides " + DEFAULT_OUTPUT_FORMAT
|
35
|
+
option :format, values: FORMATS.keys.map(&:to_s), default: DEFAULT_FORMAT.to_s, required: false, desc: "Output format"
|
36
|
+
option :mapping, type: :string, require: false, desc: "YAML file with label to estimates mapping"
|
35
37
|
|
36
|
-
def call(repo: nil, file: nil, format: nil, **opts)
|
38
|
+
def call(repo: nil, file: nil, format: nil, mapping: nil, **opts)
|
37
39
|
super(**opts)
|
38
40
|
|
39
41
|
self.record_count = 0
|
40
|
-
self.repo
|
42
|
+
self.repo = repo
|
41
43
|
|
42
44
|
raise ArgumentError, "argument <repo> is required" unless repo
|
43
45
|
raise ArgumentError, "argument <repo> is not a repository, expected eg 'rails/rails'" unless repo =~ %r{/}
|
44
46
|
|
47
|
+
self.mapping = {}
|
48
|
+
if mapping && ::File.exist?(mapping)
|
49
|
+
self.mapping = ::YAML.safe_load(::File.read(mapping))['label-to-estimates'] || {}
|
50
|
+
end
|
51
|
+
|
52
|
+
Export.const_set(:LabelEstimates, self.mapping)
|
53
|
+
|
45
54
|
self.issues = []
|
46
55
|
self.output = StringIO.new
|
47
56
|
self.format = (format || DEFAULT_FORMAT).to_sym
|
48
57
|
|
49
58
|
self.filename = file || file_name(repo)
|
50
|
-
self.file
|
59
|
+
self.file = File.open(filename, "w")
|
51
60
|
|
52
61
|
print_summary
|
53
62
|
|
63
|
+
raise ArgumentError, "Format is not provided" unless FORMATS.key?(format&.to_sym)
|
64
|
+
|
54
65
|
# —————————— actually get all issues ———————————————
|
55
66
|
self.file.write send("render_as_#{format}", fetch_issues)
|
56
67
|
# ————————————————————————————————————————————————————————
|
@@ -62,9 +73,9 @@ module Githuh
|
|
62
73
|
|
63
74
|
def fetch_issues
|
64
75
|
client.auto_paginate = true
|
65
|
-
self.issues
|
76
|
+
self.issues = filter_issues(client.issues(repo, query: default_options)).tap do |issue_list|
|
66
77
|
self.record_count = issue_list.size
|
67
|
-
bar(
|
78
|
+
bar("Issues")&.advance
|
68
79
|
end
|
69
80
|
end
|
70
81
|
|
@@ -79,7 +90,7 @@ module Githuh
|
|
79
90
|
end
|
80
91
|
|
81
92
|
def default_options
|
82
|
-
{ state:
|
93
|
+
{ state: "open" }
|
83
94
|
end
|
84
95
|
|
85
96
|
def self.issue_labels(issue)
|
@@ -87,42 +98,33 @@ module Githuh
|
|
87
98
|
end
|
88
99
|
|
89
100
|
def self.find_user(client, username)
|
90
|
-
@user_cache
|
101
|
+
@user_cache ||= {}
|
91
102
|
@user_cache[username] ||= client.user(username).name
|
92
103
|
end
|
93
104
|
|
94
105
|
CSV_MAP = {
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
el = issue_labels(issue).find { |l|
|
99
|
-
el ?
|
106
|
+
"Labels" => ->(_client, issue) { issue_labels(issue).reject { |l| LabelEstimates.key?(l) }.join(",").downcase },
|
107
|
+
"Type" => ->(*) { "feature" },
|
108
|
+
"Estimate" => ->(_client, issue) do
|
109
|
+
el = issue_labels(issue).find { |l| LabelEstimates.key?(l) }
|
110
|
+
el ? LabelEstimates[el] : nil
|
100
111
|
end,
|
101
|
-
|
102
|
-
|
112
|
+
"Current State" => ->(*) { "unstarted" },
|
113
|
+
"Requested By" => ->(client, issue) do
|
103
114
|
find_user(client, issue.user.login)
|
104
115
|
end,
|
105
|
-
|
116
|
+
"Owned By" => ->(client, issue) do
|
106
117
|
find_user(client, issue.user.login)
|
107
118
|
end,
|
108
|
-
|
119
|
+
"Description" => ->(_client, issue) {
|
109
120
|
issue.body
|
110
121
|
},
|
111
|
-
|
112
|
-
}.freeze
|
113
|
-
|
114
|
-
LABEL_ESTIMATES = {
|
115
|
-
'XXL(13 eng day)' => 15,
|
116
|
-
'XL(8 eng day)' => 15,
|
117
|
-
'xs(<=1 eng day)' => 3,
|
118
|
-
'L(5 eng day)' => 15,
|
119
|
-
'm(3 eng day)' => 9,
|
120
|
-
's(2 eng day)' => 6
|
122
|
+
"Created at" => ->(_client, issue) { issue.created_at },
|
121
123
|
}.freeze
|
122
124
|
|
123
125
|
CSV_HEADER = %w(Id Title Labels Type Estimate) +
|
124
|
-
|
125
|
-
|
126
|
+
["Current State", "Created at", "Accepted at", "Deadline", "Requested By",
|
127
|
+
"Owned By", "Description", "Comment", "Comment", "Comment", "Comment"].freeze
|
126
128
|
|
127
129
|
# Id,Title,Labels,Type,Estimate,Current State,Created at,Accepted at,Deadline,Requested By,Owned By,Description,Comment,Comment
|
128
130
|
# 100, existing started story,"label one,label two",feature,1,started,"Nov 22, 2007",,,user1,user2,this will update story 100,,
|
@@ -136,16 +138,16 @@ module Githuh
|
|
136
138
|
row = []
|
137
139
|
CSV_HEADER.each do |column|
|
138
140
|
method = column.downcase.underscore.to_sym
|
139
|
-
value
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
141
|
+
value = if CSV_MAP[column]
|
142
|
+
CSV_MAP[column][client, issue]
|
143
|
+
else
|
144
|
+
begin
|
145
|
+
issue.to_h[method]
|
146
|
+
rescue StandardError
|
147
|
+
nil
|
148
|
+
end
|
146
149
|
end
|
147
|
-
|
148
|
-
value = value.strip if value.is_a?(String)
|
150
|
+
value = value.strip if value.is_a?(String)
|
149
151
|
row << value
|
150
152
|
end
|
151
153
|
csv << row
|
@@ -164,7 +166,7 @@ module Githuh
|
|
164
166
|
def print_conclusion
|
165
167
|
puts
|
166
168
|
puts TTY::Box.info("Success: written a total of #{record_count} records to #{filename}",
|
167
|
-
width: ui_width, padding: 1)
|
169
|
+
**{ width: ui_width, padding: 1 })
|
168
170
|
puts
|
169
171
|
end
|
170
172
|
|
@@ -173,8 +175,7 @@ module Githuh
|
|
173
175
|
puts TTY::Box.info("Format : #{self.format}\n" \
|
174
176
|
"File : #{filename}\n" \
|
175
177
|
"Repo : #{repo}\n",
|
176
|
-
width:
|
177
|
-
padding: 1)
|
178
|
+
**{ width: ui_width, padding: 1 })
|
178
179
|
puts
|
179
180
|
end
|
180
181
|
|
@@ -184,8 +185,8 @@ module Githuh
|
|
184
185
|
end
|
185
186
|
end
|
186
187
|
|
187
|
-
register
|
188
|
-
prefix.register
|
188
|
+
register "issue", aliases: ["r"] do |prefix|
|
189
|
+
prefix.register "export", Issue::Export
|
189
190
|
end
|
190
191
|
end
|
191
192
|
end
|
@@ -98,7 +98,9 @@ module Githuh
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def bar_size
|
101
|
-
client
|
101
|
+
return 1 if client&.last_response.nil?
|
102
|
+
|
103
|
+
client&.last_response.rels[:last].href.match(/page=(\d+).*$/)[1].to_i
|
102
104
|
end
|
103
105
|
|
104
106
|
def render_as_markdown(repositories)
|
data/lib/githuh/cli/launcher.rb
CHANGED
@@ -6,6 +6,8 @@ require 'tty/box'
|
|
6
6
|
require 'tty/screen'
|
7
7
|
|
8
8
|
require 'githuh'
|
9
|
+
require 'githuh/cli/commands/base'
|
10
|
+
|
9
11
|
module Githuh
|
10
12
|
module CLI
|
11
13
|
class Launcher
|
@@ -33,11 +35,12 @@ module Githuh
|
|
33
35
|
Githuh.configure_kernel_behavior!
|
34
36
|
end
|
35
37
|
|
38
|
+
# noinspection RubyYardParamTypeMatch
|
36
39
|
self.command = ::Dry::CLI.new(::Githuh::CLI::Commands)
|
37
40
|
command.call(arguments: argv, out: stdout, err: stderr)
|
38
41
|
rescue StandardError => e
|
39
42
|
lines = [e.message.gsub(/\n/, ', ')]
|
40
|
-
if e.backtrace
|
43
|
+
if e.backtrace && !(ARGV & %w[-v --verbose]).empty?
|
41
44
|
lines << ''
|
42
45
|
lines.concat(e.backtrace)
|
43
46
|
end
|
data/lib/githuh/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: githuh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Gredeskoul
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: hashie
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: octokit
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -256,6 +270,7 @@ files:
|
|
256
270
|
- Rakefile
|
257
271
|
- WARRANTY.md
|
258
272
|
- codecov.yml
|
273
|
+
- config/label-mapping.yml
|
259
274
|
- docs/img/coverage.svg
|
260
275
|
- docs/img/githuh-issue-export.png
|
261
276
|
- exe/githuh
|