/ dot_config / television / cable / ssh-hosts.toml
ssh-hosts.toml
 1  [metadata]
 2  name = "ssh-hosts"
 3  description = "A channel to select hosts from your SSH config"
 4  requirements = ["grep", "tr", "cut", "awk"]
 5  
 6  [source]
 7  command = "grep -E '^Host(name)? ' $HOME/.ssh/config | tr -s ' ' | cut -d' ' -f2- | tr ' ' '\n' | grep -v '^$'"
 8  
 9  [preview]
10  command = "awk '/^Host / { found=0 } /^Host (.*[[:space:]])?'{}'([[:space:]].*)?$/ { found=1 } found' $HOME/.ssh/config"
11  
12  [keybindings]
13  enter = "actions:connect"
14  
15  [actions.connect]
16  description = "SSH into the selected host"
17  command = "ssh '{}'"
18  mode = "execute"