hiiro 0.1.195 → 0.1.196

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: a3c933ca4e69cc960168f19d71e34bb14a4230b0d67ef71797cdf6897694b32f
4
- data.tar.gz: 1e2f82f42b4728107629514d791daf61306d81e31e859dc89a8b4f4c185eecee
3
+ metadata.gz: 2af78273119c7e6d0f86e2b9d2d08731764565d1916d778d96f4060acb35382c
4
+ data.tar.gz: fe0f4b4c9109bb8860bd6e978279b39d1e83cc27a8704195d8b04617b90e7a8c
5
5
  SHA512:
6
- metadata.gz: 66539fde7270dc23960b84c6688502311065bf2039017329cf908f222a0acebfba800bed348e7f60e116fb7931b7329bccd8b77f9310aa038f2b59343f9dd824
7
- data.tar.gz: 42c9f7c37ccd8ab770fbea53bb27b0dbec3d1b5c919c7bc6d3a27ad12b60e2995d99f38f00cf38d7f33698a7841fd61f7de4b9674bc5688dcaa60b15026530d1
6
+ metadata.gz: 22425cea8ad3bf9ca19b42923091d2503b12d84c81736858edc71d7575965033b7c9f82d98335379757cb72729679a5042e23fc5d75a325e73e09686374bdf67
7
+ data.tar.gz: 55a814d2c0c3467a76447f643866e14d26a881cdf650e2f244d3926d4e87a1f2e6917a05e993d13ed9a5d91c2e46bd615d778fff33999376bf5a0e0446d21baf
data/bin/h-claude CHANGED
@@ -25,56 +25,31 @@ end
25
25
  Hiiro.run(*ARGV, plugins: [Pins]) {
26
26
  add_subcmd(:split) { |*args|
27
27
  opts = opts.parse(args)
28
- direction = opts.horizontal ? '-v' : '-h'
29
28
 
30
29
  size = opts.size || '40'
31
30
  size += '%' if opts.percent
32
31
 
33
- system('tmux', 'split-window', direction, '-l', size, start_command(opts))
32
+ tmux_client.split_window(horizontal: !opts.horizontal, size: size, command: start_command(opts))
34
33
  }
35
34
 
36
35
  add_subcmd(:vsplit) { |*args|
37
- cmd = %w[
38
- tmux split-window -h
39
- ]
40
-
41
36
  opts = opts.parse(args)
42
37
 
43
- if opts.size
44
- size = opts.size
45
- size += '%' if opts.percent
46
-
47
- cmd << '-l'
48
- cmd << size
49
- end
38
+ size = opts.size
39
+ size += '%' if size && opts.percent
50
40
 
51
- system(*cmd, start_command(opts))
52
-
53
- if opts.left
54
- system('tmux', 'swap-pane', '-d', '-t', '0')
55
- end
41
+ tmux_client.vsplit_window(size: size, command: start_command(opts))
42
+ tmux_client.swap_current_pane(0, keep_active: true) if opts.left
56
43
  }
57
44
 
58
45
  add_subcmd(:hsplit) { |*args|
59
- cmd = %w[
60
- tmux split-window -v
61
- ]
62
-
63
46
  opts = opts.parse(args)
64
47
 
65
- if opts.size
66
- size = opts.size
67
- size += '%' if opts.percent
68
-
69
- cmd << '-l'
70
- cmd << size
71
- end
48
+ size = opts.size
49
+ size += '%' if size && opts.percent
72
50
 
73
- system(*cmd, start_command(opts))
74
-
75
- unless opts.bottom
76
- system('tmux', 'swap-pane', '-d', '-t', '0')
77
- end
51
+ tmux_client.hsplit_window(size: size, command: start_command(opts))
52
+ tmux_client.swap_current_pane(0, keep_active: true) unless opts.bottom
78
53
  }
79
54
 
80
55
  add_subcmd(:env) { |*args|
data/lib/hiiro/tmux.rb CHANGED
@@ -199,12 +199,22 @@ class Hiiro
199
199
 
200
200
  # Pane methods
201
201
 
202
- def split_window(horizontal: false, target: nil, start_directory: nil)
202
+ def vsplit_window(**kwargs)
203
+ split_window(horizontal: false, **kwargs)
204
+ end
205
+
206
+ def hsplit_window(**kwargs)
207
+ split_window(horizontal: true, **kwargs)
208
+ end
209
+
210
+ def split_window(horizontal: false, target: nil, start_directory: nil, size: nil, command: nil)
203
211
  args = ['split-window']
204
212
  args << '-h' if horizontal
205
213
  args << '-v' unless horizontal
206
214
  args += ['-t', target] if target
207
215
  args += ['-c', start_directory] if start_directory
216
+ args += ['-l', size] if size
217
+ args << command if command
208
218
  run_system(*args)
209
219
  end
210
220
 
@@ -216,8 +226,11 @@ class Hiiro
216
226
  run_system('select-pane', '-t', target)
217
227
  end
218
228
 
219
- def swap_current_pane(dst=0)
220
- run_system('swap-pane', '-t', dst&.to_s)
229
+ def swap_current_pane(dst=0, keep_active: false)
230
+ args = ['swap-pane']
231
+ args << '-d' if keep_active
232
+ args += ['-t', dst&.to_s]
233
+ run_system(*args)
221
234
  end
222
235
 
223
236
  def swap_pane(src, dst)
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.195"
2
+ VERSION = "0.1.196"
3
3
  end
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.195
4
+ version: 0.1.196
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota