summaryrefslogtreecommitdiff
path: root/arch/scripts/.local/bin/seshc.sh
diff options
context:
space:
mode:
authorsteven-na <noreply.github@stvnc.dev>2026-07-11 00:27:47 -0700
committersteven-na <noreply.github@stvnc.dev>2026-07-11 00:27:47 -0700
commit6abeaadbe4cea91eb444cf23241b7f0320f2dc33 (patch)
tree0a3bd136892060791cdf489aee44bbd6195243bc /arch/scripts/.local/bin/seshc.sh
parenta0045be331fa7191dd1b23fbd5720b543ce959d8 (diff)
Lots of changes
Diffstat (limited to 'arch/scripts/.local/bin/seshc.sh')
-rw-r--r--arch/scripts/.local/bin/seshc.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/scripts/.local/bin/seshc.sh b/arch/scripts/.local/bin/seshc.sh
new file mode 100644
index 0000000..0c659d6
--- /dev/null
+++ b/arch/scripts/.local/bin/seshc.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+query="${1:-}"
+
+sessions=$(sesh list -j -t)
+
+if [[ -z "$query" ]]; then
+ name=$(jq -r '.[0].Name' <<<"$sessions")
+else
+ name=$(jq -r '.[].Name' <<<"$sessions" | fzf --filter "$query" | head -n1)
+fi
+
+if [[ -z "${name:-}" ]]; then
+ echo "${0:-}: no session matched '$query'" >&2
+ exit 1
+fi
+
+exec sesh connect "$name"