From 38dcb5cf4fc6d8592732ad48736bb2ee4b8a277b Mon Sep 17 00:00:00 2001 From: Buddy Date: Tue, 21 Jan 2025 10:46:27 -0800 Subject: [PATCH] Add tmux inspect sessions --- dot_config/nushell/config.nu.tmpl | 1 + dot_config/nushell/lib/inspect/mod.nu | 1 + dot_config/nushell/lib/inspect/tmux.nu | 15 +++++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 dot_config/nushell/lib/inspect/mod.nu create mode 100644 dot_config/nushell/lib/inspect/tmux.nu diff --git a/dot_config/nushell/config.nu.tmpl b/dot_config/nushell/config.nu.tmpl index 4369e46..19f40e0 100644 --- a/dot_config/nushell/config.nu.tmpl +++ b/dot_config/nushell/config.nu.tmpl @@ -5,6 +5,7 @@ source xdg.nu use themes.nu use completions * +use inspect #{{- if eq .age_key "age1htqslfl4d5uv76j8eg49u9njqjx5udj9jmg3ujf2gxjjm06z0vqqwz6tlm" }} overlay use work #{{- end }} diff --git a/dot_config/nushell/lib/inspect/mod.nu b/dot_config/nushell/lib/inspect/mod.nu new file mode 100644 index 0000000..d3f3d44 --- /dev/null +++ b/dot_config/nushell/lib/inspect/mod.nu @@ -0,0 +1 @@ +export use tmux.nu diff --git a/dot_config/nushell/lib/inspect/tmux.nu b/dot_config/nushell/lib/inspect/tmux.nu new file mode 100644 index 0000000..db6c015 --- /dev/null +++ b/dot_config/nushell/lib/inspect/tmux.nu @@ -0,0 +1,15 @@ +# list of tmux sessions +export def sessions []: [ + nothing -> table + >> +] { + tmux list-sessions -F "#{session_name}\t#{session_id}\t#{session_windows}\t#{session_attached}\t#{session_attached_list}" + | from tsv --noheaders + | rename name id windows attached attached_list + | update attached_list { split row , } +}