bugsink-cli 0.1.0 → 0.1.2
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.
- checksums.yaml +4 -4
- data/README.md +17 -8
- data/lib/bugsink/cli.rb +39 -13
- data/lib/bugsink/config.rb +23 -1
- data/lib/bugsink/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 332213d0fe5dd0cffa80562ed080efcf15df8efb3a33d9efd6916bd5f3b86558
|
|
4
|
+
data.tar.gz: 752a775192b2bf8d719a1ac18b4916a8f619159b1dda6df6702a7e27adc8302a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8be23b51ee505b803159e7aae993b91f091c21124980202f4a2e833f485b5faa3201ff41a7d3d74b499be1ddd7ef09de06c1a986238cf61a872869bae7a3bf1e
|
|
7
|
+
data.tar.gz: 5fcc6bcf7b826c2779879c4f9634393934d803c85951d9671e04d466aadbc31b35acab7bf800673135815d7977d92a6ed156cf3f40a42c4ff95cadc71e889724
|
data/README.md
CHANGED
|
@@ -25,18 +25,24 @@ gem 'bugsink-cli', '~> 0.1.0'
|
|
|
25
25
|
|
|
26
26
|
**Optional:**
|
|
27
27
|
- `BUGSINK_HOST` - API host (default: `https://bugs.kopernici.cz`)
|
|
28
|
+
- `BUGSINK_PROJECT_ID` - Default project ID (takes precedence over `.bugsink` file)
|
|
28
29
|
|
|
29
30
|
### Project Configuration
|
|
30
31
|
|
|
31
|
-
The CLI supports
|
|
32
|
+
The CLI supports two ways to set a default project ID:
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
1. **Environment Variable (recommended for CI/CD):**
|
|
35
|
+
```bash
|
|
36
|
+
export BUGSINK_PROJECT_ID=8
|
|
37
|
+
```
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
2. **Local `.bugsink` file (recommended for development):**
|
|
40
|
+
```bash
|
|
41
|
+
bugsink config set-project 8
|
|
42
|
+
# This creates .bugsink file with: PROJECT_ID=8
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Note:** The environment variable takes precedence over the `.bugsink` file. When `BUGSINK_PROJECT_ID` is set, the `config set-project` command will not create a `.bugsink` file.
|
|
40
46
|
|
|
41
47
|
## Quick Start
|
|
42
48
|
|
|
@@ -47,7 +53,10 @@ export BUGSINK_API_KEY="your-token-here"
|
|
|
47
53
|
# Test connection
|
|
48
54
|
bugsink config test
|
|
49
55
|
|
|
50
|
-
# Set default project
|
|
56
|
+
# Set default project (option 1: environment variable)
|
|
57
|
+
export BUGSINK_PROJECT_ID=8
|
|
58
|
+
|
|
59
|
+
# Or set default project (option 2: local file)
|
|
51
60
|
bugsink config set-project 8
|
|
52
61
|
|
|
53
62
|
# List latest issues
|
data/lib/bugsink/cli.rb
CHANGED
|
@@ -91,8 +91,11 @@ module Bugsink
|
|
|
91
91
|
output_list(response.data, format: @options[:format])
|
|
92
92
|
when 'get'
|
|
93
93
|
uuid = args[0]
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
unless uuid
|
|
95
|
+
error('Team UUID required')
|
|
96
|
+
exit 1
|
|
97
|
+
end
|
|
98
|
+
parse_format_options!(args[1..] || [])
|
|
96
99
|
team = @client.team_get(uuid)
|
|
97
100
|
output_single(team, format: @options[:format])
|
|
98
101
|
when 'create'
|
|
@@ -128,8 +131,11 @@ module Bugsink
|
|
|
128
131
|
output_list(response.data, format: @options[:format])
|
|
129
132
|
when 'get'
|
|
130
133
|
id = args[0]
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
unless id
|
|
135
|
+
error('Project ID required')
|
|
136
|
+
exit 1
|
|
137
|
+
end
|
|
138
|
+
parse_format_options!(args[1..] || [])
|
|
133
139
|
project = @client.project_get(id.to_i)
|
|
134
140
|
output_single(project, format: @options[:format])
|
|
135
141
|
when 'create'
|
|
@@ -178,8 +184,11 @@ module Bugsink
|
|
|
178
184
|
output_list(response.data, format: @options[:format])
|
|
179
185
|
when 'get'
|
|
180
186
|
uuid = args[0]
|
|
181
|
-
|
|
182
|
-
|
|
187
|
+
unless uuid
|
|
188
|
+
error('Issue UUID required')
|
|
189
|
+
exit 1
|
|
190
|
+
end
|
|
191
|
+
parse_format_options!(args[1..] || [])
|
|
183
192
|
issue = @client.issue_get(uuid)
|
|
184
193
|
output_single(issue, format: @options[:format])
|
|
185
194
|
else
|
|
@@ -201,8 +210,11 @@ module Bugsink
|
|
|
201
210
|
output_list(response.data, format: @options[:format])
|
|
202
211
|
when 'get'
|
|
203
212
|
uuid = args[0]
|
|
204
|
-
|
|
205
|
-
|
|
213
|
+
unless uuid
|
|
214
|
+
error('Event UUID required')
|
|
215
|
+
exit 1
|
|
216
|
+
end
|
|
217
|
+
parse_format_options!(args[1..] || [])
|
|
206
218
|
event = @client.event_get(uuid)
|
|
207
219
|
output_single(event, format: @options[:format])
|
|
208
220
|
when 'stacktrace'
|
|
@@ -226,8 +238,11 @@ module Bugsink
|
|
|
226
238
|
output_list(response.data, format: @options[:format])
|
|
227
239
|
when 'get'
|
|
228
240
|
uuid = args[0]
|
|
229
|
-
|
|
230
|
-
|
|
241
|
+
unless uuid
|
|
242
|
+
error('Release UUID required')
|
|
243
|
+
exit 1
|
|
244
|
+
end
|
|
245
|
+
parse_format_options!(args[1..] || [])
|
|
231
246
|
release = @client.release_get(uuid)
|
|
232
247
|
output_single(release, format: @options[:format])
|
|
233
248
|
when 'create'
|
|
@@ -246,6 +261,8 @@ module Bugsink
|
|
|
246
261
|
end
|
|
247
262
|
|
|
248
263
|
def parse_format_options!(args)
|
|
264
|
+
return if args.nil? || args.empty?
|
|
265
|
+
|
|
249
266
|
OptionParser.new do |opts|
|
|
250
267
|
opts.on('--json', 'Output as JSON') { @options[:format] = 'json' }
|
|
251
268
|
opts.on('--quiet', 'Minimal output') { @options[:format] = 'quiet' }
|
|
@@ -253,6 +270,8 @@ module Bugsink
|
|
|
253
270
|
end
|
|
254
271
|
|
|
255
272
|
def parse_project_options!(args)
|
|
273
|
+
return if args.nil? || args.empty?
|
|
274
|
+
|
|
256
275
|
OptionParser.new do |opts|
|
|
257
276
|
opts.on('--team=UUID', 'Filter by team UUID') { |v| @options[:team] = v }
|
|
258
277
|
opts.on('--json', 'Output as JSON') { @options[:format] = 'json' }
|
|
@@ -261,6 +280,8 @@ module Bugsink
|
|
|
261
280
|
end
|
|
262
281
|
|
|
263
282
|
def parse_issue_options!(args)
|
|
283
|
+
return if args.nil? || args.empty?
|
|
284
|
+
|
|
264
285
|
OptionParser.new do |opts|
|
|
265
286
|
opts.on('--project=ID', 'Project ID') { |v| @options[:project_id] = v.to_i }
|
|
266
287
|
opts.on('--sort=FIELD', 'Sort field') { |v| @options[:sort] = v }
|
|
@@ -271,6 +292,8 @@ module Bugsink
|
|
|
271
292
|
end
|
|
272
293
|
|
|
273
294
|
def parse_event_options!(args)
|
|
295
|
+
return if args.nil? || args.empty?
|
|
296
|
+
|
|
274
297
|
OptionParser.new do |opts|
|
|
275
298
|
opts.on('--issue=UUID', 'Issue UUID (required)') { |v| @options[:issue] = v }
|
|
276
299
|
opts.on('--order=ORDER', 'Sort order (asc|desc)') { |v| @options[:order] = v }
|
|
@@ -280,6 +303,8 @@ module Bugsink
|
|
|
280
303
|
end
|
|
281
304
|
|
|
282
305
|
def parse_release_options!(args)
|
|
306
|
+
return if args.nil? || args.empty?
|
|
307
|
+
|
|
283
308
|
OptionParser.new do |opts|
|
|
284
309
|
opts.on('--project=ID', 'Project ID') { |v| @options[:project_id] = v.to_i }
|
|
285
310
|
opts.on('--json', 'Output as JSON') { @options[:format] = 'json' }
|
|
@@ -396,11 +421,12 @@ module Bugsink
|
|
|
396
421
|
bugsink releases create '{"project":8,"version":"v1.0"}'
|
|
397
422
|
|
|
398
423
|
Environment Variables:
|
|
399
|
-
BUGSINK_API_KEY
|
|
400
|
-
BUGSINK_HOST
|
|
424
|
+
BUGSINK_API_KEY API authentication token (required)
|
|
425
|
+
BUGSINK_HOST API host (default: https://bugs.kopernici.cz)
|
|
426
|
+
BUGSINK_PROJECT_ID Default project ID (takes precedence over .bugsink file)
|
|
401
427
|
|
|
402
428
|
Configuration File:
|
|
403
|
-
.bugsink Project ID for current directory
|
|
429
|
+
.bugsink Project ID for current directory (ignored if BUGSINK_PROJECT_ID is set)
|
|
404
430
|
|
|
405
431
|
For resource-specific help:
|
|
406
432
|
bugsink help <resource>
|
data/lib/bugsink/config.rb
CHANGED
|
@@ -28,6 +28,13 @@ module Bugsink
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def set_project_id(id)
|
|
31
|
+
if ENV['BUGSINK_PROJECT_ID'] && !ENV['BUGSINK_PROJECT_ID'].empty?
|
|
32
|
+
# Don't write to file if env var is set (env var takes precedence)
|
|
33
|
+
# Just update the in-memory value
|
|
34
|
+
@project_id = id
|
|
35
|
+
return
|
|
36
|
+
end
|
|
37
|
+
|
|
31
38
|
File.write(dotfile_path, "PROJECT_ID=#{id}\n")
|
|
32
39
|
@project_id = id
|
|
33
40
|
end
|
|
@@ -37,17 +44,32 @@ module Bugsink
|
|
|
37
44
|
end
|
|
38
45
|
|
|
39
46
|
def to_s
|
|
47
|
+
project_display = if project_id
|
|
48
|
+
source = ENV['BUGSINK_PROJECT_ID'] && !ENV['BUGSINK_PROJECT_ID'].empty? ? 'env' : 'file'
|
|
49
|
+
"#{project_id} (from #{source})"
|
|
50
|
+
else
|
|
51
|
+
'not set'
|
|
52
|
+
end
|
|
53
|
+
|
|
40
54
|
<<~CONFIG
|
|
41
55
|
BugSink Configuration:
|
|
42
56
|
Host: #{host}
|
|
43
57
|
API Key: #{api_key ? "#{api_key[0..8]}...#{api_key[-8..]}" : 'not set'}
|
|
44
|
-
Project ID: #{
|
|
58
|
+
Project ID: #{project_display}
|
|
45
59
|
CONFIG
|
|
46
60
|
end
|
|
47
61
|
|
|
48
62
|
private
|
|
49
63
|
|
|
50
64
|
def read_project_id
|
|
65
|
+
# Check environment variable first (takes precedence)
|
|
66
|
+
env_project_id = ENV['BUGSINK_PROJECT_ID']
|
|
67
|
+
if env_project_id && !env_project_id.empty?
|
|
68
|
+
parsed = env_project_id.to_i
|
|
69
|
+
return parsed if parsed > 0 # Ensure it's a valid positive integer
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Fall back to dotfile
|
|
51
73
|
return nil unless File.exist?(dotfile_path)
|
|
52
74
|
|
|
53
75
|
content = File.read(dotfile_path).strip
|
data/lib/bugsink/version.rb
CHANGED