abt-cli 0.0.9 → 0.0.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5044c8e5cb4330dd9db124834ee6f9bffca78a0ffaa08c268ba35eb3b0a21fe9
4
- data.tar.gz: d9eb98460e021a032f9efdc0d9b2b98a20b57aba6267ef9024ee6f840bcf6858
3
+ metadata.gz: 7b24bcf0b7e31cf18b1f86381f6dabba6434e8dfbd4a077f5447afdd20f08d7e
4
+ data.tar.gz: a66846cb48a109ea21bb7366c1432c8f7d647b5384f42565c90fa609c51d8b6b
5
5
  SHA512:
6
- metadata.gz: e2536f6b91bebf10d0fe637864045f61d04f90aa1b1ede6bd0a0db62ad54ef54cb541eda71fca2554cd741fe0011cb5586a0bb904ec412a6a07d90fc6c477208
7
- data.tar.gz: 10c5fcf70d15dcfff152cf62a3d39109db499768c5fbb96d0eadecc107c85150e9277f647da482ea72d6d2cab68974b950500c2e433a0a3f8c1547c6c6fe74a0
6
+ metadata.gz: b3610428c6ded90f53c49396d41b07fc54134dd88cb8019133c35dab230058b5506d93cfab0dc4b811b81161e45e24c1b0502dd7e03a8f3a65248db864886fb3
7
+ data.tar.gz: 6affbc39d2572a73b700367d8cdabbe84275faf663b66b0c020c1683a3ffc7f584d43b828674cc2d32f1f05a8e2695443f13c64a2d1727e7fdb7708f93a0bcf5
@@ -20,7 +20,7 @@ module Abt
20
20
  @output = output
21
21
  @err_output = err_output
22
22
 
23
- @args += args_from_stdin unless input.isatty # Add piped arguments
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 args_from_stdin
61
- input = STDIN.read
60
+ def args_from_input
61
+ input_string = input.read
62
62
 
63
- abort 'No input from pipe' if input.nil? || input.empty?
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 = input.lines.map do |line|
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
- start_output = call_start
18
- puts start_output
17
+ track_output = call_track
18
+ puts track_output
19
19
 
20
- use_arg_str(arg_str_from_start_output(start_output))
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 arg_str_from_start_output(output)
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 call_start
35
+ def call_track
36
+ input = StringIO.new(cli.args.join(' '))
36
37
  output = StringIO.new
37
- Abt::Cli.new(argv: ['track', *cli.args], output: output).perform
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', "harvest:#{project_id}/#{task_id}"],
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
- arg_strs = cli.args.join(' ')
54
- lines = `#{$PROGRAM_NAME} harvest-time-entry-data #{arg_strs}`.split("\n")
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Abt
4
- VERSION = '0.0.9'
4
+ VERSION = '0.0.10'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abt-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesper Sørensen