abt-cli 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/abt/cli.rb +5 -5
- data/lib/abt/providers/harvest/commands/start.rb +9 -8
- data/lib/abt/providers/harvest/commands/track.rb +5 -2
- data/lib/abt/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: 7b24bcf0b7e31cf18b1f86381f6dabba6434e8dfbd4a077f5447afdd20f08d7e
|
4
|
+
data.tar.gz: a66846cb48a109ea21bb7366c1432c8f7d647b5384f42565c90fa609c51d8b6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3610428c6ded90f53c49396d41b07fc54134dd88cb8019133c35dab230058b5506d93cfab0dc4b811b81161e45e24c1b0502dd7e03a8f3a65248db864886fb3
|
7
|
+
data.tar.gz: 6affbc39d2572a73b700367d8cdabbe84275faf663b66b0c020c1683a3ffc7f584d43b828674cc2d32f1f05a8e2695443f13c64a2d1727e7fdb7708f93a0bcf5
|
data/lib/abt/cli.rb
CHANGED
@@ -20,7 +20,7 @@ module Abt
|
|
20
20
|
@output = output
|
21
21
|
@err_output = err_output
|
22
22
|
|
23
|
-
@args +=
|
23
|
+
@args += args_from_input unless input.isatty # Add piped arguments
|
24
24
|
end
|
25
25
|
|
26
26
|
def perform
|
@@ -57,13 +57,13 @@ module Abt
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
def
|
61
|
-
|
60
|
+
def args_from_input
|
61
|
+
input_string = input.read
|
62
62
|
|
63
|
-
abort 'No input from pipe' if
|
63
|
+
abort 'No input from pipe' if input_string.nil? || input_string.empty?
|
64
64
|
|
65
65
|
# Exclude comment part of piped input lines
|
66
|
-
lines_without_comments =
|
66
|
+
lines_without_comments = input_string.lines.map do |line|
|
67
67
|
line.split(' # ').first
|
68
68
|
end
|
69
69
|
|
@@ -14,10 +14,10 @@ module Abt
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def call
|
17
|
-
|
18
|
-
puts
|
17
|
+
track_output = call_track
|
18
|
+
puts track_output
|
19
19
|
|
20
|
-
use_arg_str(
|
20
|
+
use_arg_str(arg_str_from_track_output(track_output))
|
21
21
|
|
22
22
|
maybe_override_current_task
|
23
23
|
rescue Abt::HttpError::HttpError => e
|
@@ -27,14 +27,15 @@ module Abt
|
|
27
27
|
|
28
28
|
private
|
29
29
|
|
30
|
-
def
|
30
|
+
def arg_str_from_track_output(output)
|
31
31
|
output = output.split(' # ').first
|
32
32
|
output.split(':')[1]
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def call_track
|
36
|
+
input = StringIO.new(cli.args.join(' '))
|
36
37
|
output = StringIO.new
|
37
|
-
Abt::Cli.new(argv: ['track'
|
38
|
+
Abt::Cli.new(argv: ['track'], output: output, input: input).perform
|
38
39
|
|
39
40
|
output_str = output.string.strip
|
40
41
|
cli.abort 'No task provided' if output_str.empty?
|
@@ -47,9 +48,9 @@ module Abt
|
|
47
48
|
return unless config.local_available?
|
48
49
|
return unless cli.prompt_boolean 'Set selected task as current?'
|
49
50
|
|
51
|
+
input = StringIO.new("harvest:#{project_id}/#{task_id}")
|
50
52
|
output = StringIO.new
|
51
|
-
Abt::Cli.new(argv: ['current',
|
52
|
-
output: output).perform
|
53
|
+
Abt::Cli.new(argv: ['current'], output: output, input: input).perform
|
53
54
|
end
|
54
55
|
end
|
55
56
|
end
|
@@ -50,8 +50,11 @@ module Abt
|
|
50
50
|
|
51
51
|
def external_link_data
|
52
52
|
@external_link_data ||= begin
|
53
|
-
|
54
|
-
|
53
|
+
input = StringIO.new(cli.args.join(' '))
|
54
|
+
output = StringIO.new
|
55
|
+
Abt::Cli.new(argv: ['harvest-time-entry-data'], output: output, input: input).perform
|
56
|
+
|
57
|
+
lines = output.string.strip.lines
|
55
58
|
|
56
59
|
return if lines.empty?
|
57
60
|
|
data/lib/abt/version.rb
CHANGED