hiiro 0.1.190 → 0.1.192
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/lib/hiiro/tasks.rb +35 -4
- 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: 4e9c1c614a89e2944fca6de6cd01965528c0ae40e9321c6bc1bb787a35d4d7dd
|
|
4
|
+
data.tar.gz: d1e0979b29abf886bae0da32950fa606defa9deac919f8d6892df83396593402
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 198254182cd9e1439126ee16ad2faaba987b15415ad7c727a72a54f6238621ecdbb313e368f54cc044f06078e3baad191f92dd2ef5aaa19e003fafbe63699982
|
|
7
|
+
data.tar.gz: a13b441f071edc502cd5c4156aaaa62f3620f2b4bc660dfa2e3f28662e59180800058552d89fb9d84c1fd3271f6b1d9c2b5f8b3dd4ebf4ae570b97b06ebbfc6f
|
data/lib/hiiro/tasks.rb
CHANGED
|
@@ -185,17 +185,21 @@ class Hiiro
|
|
|
185
185
|
puts "#{label}:"
|
|
186
186
|
puts
|
|
187
187
|
|
|
188
|
+
# Build a session→tty map once so we can show which terminal tab each session
|
|
189
|
+
# is attached in (e.g. "@s000" for Ghostty tab using ttys000).
|
|
190
|
+
client_map = TmuxSession.client_map
|
|
191
|
+
|
|
188
192
|
# Collect rows as {prefix, name, tree, branch, session} so we can
|
|
189
193
|
# compute max column widths before rendering.
|
|
190
194
|
rows = []
|
|
191
195
|
items.each do |task|
|
|
192
196
|
marker = (current && current.name == task.name) ? "*" : " "
|
|
193
|
-
rows << { prefix: "#{marker} ", **task.display_data(scope: scope, environment: environment) }
|
|
197
|
+
rows << { prefix: "#{marker} ", **task.display_data(scope: scope, environment: environment, client_map: client_map) }
|
|
194
198
|
|
|
195
199
|
if scope == :task
|
|
196
200
|
subtasks(task).each do |st|
|
|
197
201
|
sub_marker = (current && current.name == st.name) ? "*" : " "
|
|
198
|
-
rows << { prefix: "#{sub_marker} - ", **st.display_data(scope: :subtask, environment: environment) }
|
|
202
|
+
rows << { prefix: "#{sub_marker} - ", **st.display_data(scope: :subtask, environment: environment, client_map: client_map) }
|
|
199
203
|
end
|
|
200
204
|
end
|
|
201
205
|
end
|
|
@@ -225,6 +229,20 @@ class Hiiro
|
|
|
225
229
|
puts format(" %-#{avail_name_col}s (available) %s", tree.name, branch_str).rstrip
|
|
226
230
|
end
|
|
227
231
|
end
|
|
232
|
+
|
|
233
|
+
if scope == :task
|
|
234
|
+
task_session_names = environment.all_tasks.map(&:session_name)
|
|
235
|
+
extra_sessions = environment.all_sessions.reject { |s| task_session_names.include?(s.name) }
|
|
236
|
+
if extra_sessions.any?
|
|
237
|
+
puts
|
|
238
|
+
extra_name_col = [extra_sessions.map { |s| s.name.length }.max, name_col].max
|
|
239
|
+
extra_sessions.sort_by(&:name).each do |session|
|
|
240
|
+
tty = client_map[session.name]
|
|
241
|
+
suffix = tty ? " @#{tty.sub('ttys', 's')}" : ""
|
|
242
|
+
puts format(" %-#{extra_name_col}s (tmux session%s)", session.name, suffix)
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
end
|
|
228
246
|
end
|
|
229
247
|
|
|
230
248
|
def status
|
|
@@ -873,6 +891,16 @@ class Hiiro
|
|
|
873
891
|
output.lines(chomp: true).map { |name| new(name) }
|
|
874
892
|
end
|
|
875
893
|
|
|
894
|
+
# Returns { session_name => "ttysXXX" } for sessions with attached clients.
|
|
895
|
+
# The tty identifies which terminal tab (e.g. Ghostty tab) the client is in.
|
|
896
|
+
def self.client_map
|
|
897
|
+
output = `tmux list-clients -F '\#{client_tty}|\#{session_name}' 2>/dev/null`
|
|
898
|
+
output.lines(chomp: true).each_with_object({}) do |line, map|
|
|
899
|
+
tty, session = line.split('|', 2)
|
|
900
|
+
map[session] ||= tty.delete_prefix('/dev/')
|
|
901
|
+
end
|
|
902
|
+
end
|
|
903
|
+
|
|
876
904
|
def initialize(name)
|
|
877
905
|
@name = name
|
|
878
906
|
end
|
|
@@ -977,15 +1005,18 @@ class Hiiro
|
|
|
977
1005
|
h
|
|
978
1006
|
end
|
|
979
1007
|
|
|
980
|
-
def display_data(scope: :task, environment:)
|
|
1008
|
+
def display_data(scope: :task, environment:, client_map: {})
|
|
981
1009
|
display_name = (scope == :subtask) ? short_name : name
|
|
982
1010
|
tree = environment.find_tree(tree_name)
|
|
983
1011
|
branch = tree&.branch || (tree&.detached? ? '(detached)' : '(none)')
|
|
1012
|
+
sname = session_name || '(none)'
|
|
1013
|
+
tty = client_map[sname]
|
|
1014
|
+
session_str = tty ? "#{sname} @#{tty.sub('ttys', 's')}" : sname
|
|
984
1015
|
{
|
|
985
1016
|
name: display_name,
|
|
986
1017
|
tree: tree_name || '(none)',
|
|
987
1018
|
branch: "[#{branch}]",
|
|
988
|
-
session: "(#{
|
|
1019
|
+
session: "(#{session_str})"
|
|
989
1020
|
}
|
|
990
1021
|
end
|
|
991
1022
|
end
|
data/lib/hiiro/version.rb
CHANGED