hiiro 0.1.264 → 0.1.265
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/CHANGELOG.md +1 -1
- data/bin/h-pane +107 -5
- data/lib/hiiro/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: dc901c630e69f036ba17ebb63bf913618ea825ce6746d5db20df55177fd0b9ba
|
|
4
|
+
data.tar.gz: 29ef84306acd767569975e56c2c44e10868f7490040b94d80d73f20db7ade326
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 053fa8e529cb941c97447e0540cbaa2ebb48634a47911627760cd01af2f5f3251d403b69a8296443f33531efcf039bfcba738ee5f02065a475583da1bb8c7a70
|
|
7
|
+
data.tar.gz: 40073e682ab750f5e5633ea511a500bc2537708aa2abcb392b994cbd30a9c580227058859829f10838669ce5f790693d34473a480d680d11191f6b57227275ab
|
data/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Done. The CHANGELOG.md has been updated with v0.1.
|
|
1
|
+
Done. The CHANGELOG.md has been updated with v0.1.265 released today (2026-03-18), with all the unreleased features now captured in that release. An empty Unreleased section remains at the top for future entries.
|
data/bin/h-pane
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
require 'hiiro'
|
|
4
|
+
require 'yaml'
|
|
4
5
|
|
|
5
6
|
Hiiro.run(*ARGV, plugins: [Pins]) do
|
|
6
7
|
tmux = tmux_client
|
|
7
8
|
|
|
9
|
+
home_config_path = Hiiro::Config.path('pane_homes.yml')
|
|
10
|
+
|
|
11
|
+
load_homes = -> {
|
|
12
|
+
return {} unless File.exist?(home_config_path)
|
|
13
|
+
YAML.load_file(home_config_path) || {}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
save_homes = ->(config) {
|
|
17
|
+
File.write(home_config_path, config.to_yaml)
|
|
18
|
+
}
|
|
19
|
+
|
|
8
20
|
add_subcmd(:ls) { |*args|
|
|
9
21
|
if args.empty?
|
|
10
22
|
tmux.panes.each { |p| puts p.to_s }
|
|
@@ -95,13 +107,103 @@ Hiiro.run(*ARGV, plugins: [Pins]) do
|
|
|
95
107
|
end
|
|
96
108
|
}
|
|
97
109
|
|
|
98
|
-
add_subcmd(:sw
|
|
99
|
-
|
|
100
|
-
|
|
110
|
+
add_subcmd(:sw) { |target = nil, *args|
|
|
111
|
+
target ||= fuzzyfind_from_map(tmux.panes(all: true).name_map)
|
|
112
|
+
tmux.open_session(target) if target
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
add_subcmd(:switch) { |name = nil|
|
|
116
|
+
homes = load_homes.call
|
|
117
|
+
|
|
118
|
+
if name.nil?
|
|
119
|
+
if homes.empty?
|
|
120
|
+
puts "No home panes configured. Use 'h pane home add <name> <session> [path]'"
|
|
121
|
+
next
|
|
122
|
+
end
|
|
123
|
+
display_map = homes.each_with_object({}) do |(n, cfg), h|
|
|
124
|
+
label = "#{n} [#{cfg['session']}#{cfg['path'] ? " #{cfg['path']}" : ''}]"
|
|
125
|
+
h[label] = n
|
|
126
|
+
end
|
|
127
|
+
name = fuzzyfind_from_map(display_map)
|
|
128
|
+
next unless name
|
|
101
129
|
end
|
|
102
130
|
|
|
103
|
-
|
|
104
|
-
|
|
131
|
+
cfg = homes[name]
|
|
132
|
+
unless cfg
|
|
133
|
+
matched = homes.keys.select { |k| k.start_with?(name) }
|
|
134
|
+
case matched.size
|
|
135
|
+
when 1
|
|
136
|
+
name = matched.first
|
|
137
|
+
cfg = homes[name]
|
|
138
|
+
when 0
|
|
139
|
+
puts "Home pane '#{name}' not found"
|
|
140
|
+
next
|
|
141
|
+
else
|
|
142
|
+
puts "Ambiguous home pane '#{name}': #{matched.join(', ')}"
|
|
143
|
+
next
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
session = cfg['session']
|
|
148
|
+
path = cfg['path']
|
|
149
|
+
|
|
150
|
+
if !tmux.session_exists?(session)
|
|
151
|
+
tmux.new_session(session, detached: true, start_directory: path, window_name: name)
|
|
152
|
+
else
|
|
153
|
+
window_names = `tmux list-windows -t #{session.shellescape} -F '\#{window_name}' 2>/dev/null`.lines(chomp: true)
|
|
154
|
+
unless window_names.include?(name)
|
|
155
|
+
tmux.new_window(name: name, target: session, start_directory: path)
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
target = "#{session}:#{name}"
|
|
160
|
+
if tmux.in_tmux?
|
|
161
|
+
system('tmux', 'switch-client', '-t', target)
|
|
162
|
+
else
|
|
163
|
+
system('tmux', 'attach-session', '-t', target)
|
|
164
|
+
end
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
add_subcmd(:home) { |*args|
|
|
168
|
+
run_child(:home) do |h|
|
|
169
|
+
h.add_subcmd(:ls) {
|
|
170
|
+
homes = load_homes.call
|
|
171
|
+
if homes.empty?
|
|
172
|
+
puts "No home panes configured."
|
|
173
|
+
puts "Use: h pane home add <name> <session> [path]"
|
|
174
|
+
else
|
|
175
|
+
homes.each do |name, cfg|
|
|
176
|
+
path_str = cfg['path'] ? " #{cfg['path']}" : ''
|
|
177
|
+
puts "#{name.ljust(20)} #{cfg['session']}#{path_str}"
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
h.add_subcmd(:add) { |name, session, path = nil|
|
|
183
|
+
unless name && session
|
|
184
|
+
puts "Usage: h pane home add <name> <session> [path]"
|
|
185
|
+
next
|
|
186
|
+
end
|
|
187
|
+
homes = load_homes.call
|
|
188
|
+
homes[name] = { 'session' => session }
|
|
189
|
+
homes[name]['path'] = File.expand_path(path) if path
|
|
190
|
+
save_homes.call(homes)
|
|
191
|
+
puts "Added '#{name}' → #{session}#{path ? " (#{File.expand_path(path)})" : ''}"
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
h.add_subcmd(:rm) { |name|
|
|
195
|
+
unless name
|
|
196
|
+
puts "Usage: h pane home rm <name>"
|
|
197
|
+
next
|
|
198
|
+
end
|
|
199
|
+
homes = load_homes.call
|
|
200
|
+
if homes.delete(name)
|
|
201
|
+
save_homes.call(homes)
|
|
202
|
+
puts "Removed home pane '#{name}'"
|
|
203
|
+
else
|
|
204
|
+
puts "Home pane '#{name}' not found"
|
|
205
|
+
end
|
|
206
|
+
}
|
|
105
207
|
end
|
|
106
208
|
}
|
|
107
209
|
|
data/lib/hiiro/version.rb
CHANGED