hiiro 0.1.45 → 0.1.46

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: c02548664ecc1e746e704290bfdd88e5e1b127f415cc9e137f062469377e8177
4
- data.tar.gz: 13835811c4e81042a2dc023a1ea694d72235d9b0858c146c7753542bc3794221
3
+ metadata.gz: 38b5114c13aecafc04f977e28b3d1367dbdccaf6820c318cbcabff3fa6adceed
4
+ data.tar.gz: 6d3f7b8b38955698b77fc7d4e6920afc6b1d5630df5e045a6bbce63784a22bb6
5
5
  SHA512:
6
- metadata.gz: e09c3fb2e2761421b21f7fef9fa405f5f83877e7957b9b8c255334a4b9b78ca1a4580f78f01c546570989ceda512dd81bd890c401690b24bb75466ca20c3a4ac
7
- data.tar.gz: e5a1c73b9033a1f4e38c5bd413a47e6a387f35d5381d0b5084ca6f7de9aefd80b6d2343e3afcaaeec98f59efbd459427468039a7d94f8aa5fc60f22a13703315
6
+ metadata.gz: 3d22cd8016c63f2c62c2d24c3f1f06860c57bd2348d54f33f74130efad5993cf95e6e93de2aeabe778ed063fa006f0e8c905dd4f1a70832f2226e5bf2bcb3d04
7
+ data.tar.gz: c07e1243ee16e2bdcd8abf968669429b6c8fbdd1732f6f009daa4fc7dca6b85b98200882576cea7e918639b8b7ada9a13c146ae434c4fa18578efaea9492a669
data/bin/h-otask CHANGED
@@ -229,14 +229,12 @@ class TaskManager
229
229
  "#{tree_name.ljust(20)} => #{task}"
230
230
  end
231
231
 
232
- require 'open3'
233
- selected, status = Open3.capture2('sk', stdin_data: lines.join("\n"))
232
+ selected = Hiiro::Sk.select(lines)
233
+ return nil unless selected
234
234
 
235
- if status.success? && !selected.strip.empty?
236
- # Parse the selected line to extract the task name
237
- if selected =~ /=>\s*(\S+)/
238
- return $1
239
- end
235
+ # Parse the selected line to extract the task name
236
+ if selected =~ /=>\s*(\S+)/
237
+ return $1
240
238
  end
241
239
 
242
240
  nil
data/lib/hiiro/sk.rb ADDED
@@ -0,0 +1,17 @@
1
+ require 'open3'
2
+
3
+ class Hiiro
4
+ class Sk
5
+ def self.select(lines)
6
+ input = lines.is_a?(Array) ? lines.join("\n") : lines.to_s
7
+ selected, status = Open3.capture2('sk', stdin_data: input)
8
+
9
+ return nil unless status.success?
10
+
11
+ result = selected.strip
12
+ return nil if result.empty?
13
+
14
+ result
15
+ end
16
+ end
17
+ end
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.45"
2
+ VERSION = "0.1.46"
3
3
  end
data/lib/hiiro.rb CHANGED
@@ -5,6 +5,7 @@ require "shellwords"
5
5
  require_relative "hiiro/version"
6
6
  require_relative "hiiro/history"
7
7
  require_relative "hiiro/options"
8
+ require_relative "hiiro/sk"
8
9
 
9
10
  class String
10
11
  def underscore(camel_cased_word=self)
@@ -211,6 +212,10 @@ class Hiiro
211
212
  i = Args.new(*args)
212
213
  end
213
214
 
215
+ def sk(lines)
216
+ Sk.select(lines)
217
+ end
218
+
214
219
  def get_value(name)
215
220
  runner&.values&.[](name)
216
221
  end
data/plugins/old_task.rb CHANGED
@@ -661,16 +661,11 @@ module OldTask
661
661
  return nil
662
662
  end
663
663
 
664
- require 'open3'
665
- selected, status = Open3.capture2('sk', stdin_data: lines.join("\n"))
664
+ choice = Hiiro::Sk.select(lines)
665
+ return nil unless choice
666
+ return 'main' if choice == '(main)'
666
667
 
667
- if status.success? && !selected.strip.empty?
668
- choice = selected.strip
669
- return 'main' if choice == '(main)'
670
- return choice
671
- end
672
-
673
- nil
668
+ choice
674
669
  end
675
670
 
676
671
  # Show status for the current subtask
data/plugins/tasks.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'yaml'
2
2
  require 'fileutils'
3
- require 'open3'
4
3
 
5
4
  WORK_DIR = File.join(Dir.home, 'work')
6
5
  REPO_PATH = File.join(WORK_DIR, '.bare')
@@ -757,9 +756,7 @@ class TaskManager
757
756
  end
758
757
 
759
758
  def sk_select(items)
760
- selected, status = Open3.capture2('sk', stdin_data: items.join("\n"))
761
- return selected.strip if status.success? && !selected.strip.empty?
762
- nil
759
+ Hiiro::Sk.select(items)
763
760
  end
764
761
  end
765
762
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.45
4
+ version: 0.1.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota
@@ -80,6 +80,7 @@ files:
80
80
  - lib/hiiro.rb
81
81
  - lib/hiiro/history.rb
82
82
  - lib/hiiro/options.rb
83
+ - lib/hiiro/sk.rb
83
84
  - lib/hiiro/version.rb
84
85
  - notes
85
86
  - plugins/notify.rb