Commit 3d68ed7

xxwhirlpool  ·  2026-07-16 14:21:50 -0400 EDT
parent b4a6652
tailnet switch menu
1 files changed,  +23, -0
+23, -0
 1@@ -0,0 +1,23 @@
 2+#!/usr/bin/env bash
 3+#
 4+# switch between tailnets
 5+# doesn't check for profile access
 6+
 7+# get a list of tailnets
 8+# format is: id name\n
 9+ts_list() {
10+	tailscale switch --list | awk 'NR>1 {$3=""; print $0}'
11+}
12+
13+# get the ids only
14+ts_ids=$(ts_list | awk '{print $0}')
15+
16+# turn ids into array
17+readarray -t ts_array <<< "$ts_ids"
18+
19+# prompt user to pick from tailnet list
20+# shows id + name, awk makes it pick id
21+choose=$(gum choose "${ts_array[@]}" | awk '{print $1}')
22+
23+# do the switch
24+tailscale switch "$choose"