nu: Add tailscale ssh command
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
# Get networking info about tailscale peers
|
||||
def "tailscale peer" [
|
||||
hostname?: string
|
||||
path?: cell-path
|
||||
get_field?: cell-path
|
||||
]: nothing -> any {
|
||||
let path = ($path | default ([] | into cell-path))
|
||||
let get_field = ($get_field | default ([] | into cell-path))
|
||||
|
||||
let status = (^tailscale status --json | from json)
|
||||
|
||||
@ -26,6 +27,14 @@ def "tailscale peer" [
|
||||
if $hostname == null {
|
||||
$peers
|
||||
} else {
|
||||
$peers | where host == $hostname | first | get $path
|
||||
$peers | where host == $hostname | first | get $get_field
|
||||
}
|
||||
}
|
||||
|
||||
# SSH to a tailscale peer
|
||||
def "tailscale ssh" [
|
||||
hostname?: string
|
||||
...ssh_flags: string
|
||||
]: nothing -> any {
|
||||
ssh -o $"HostName (tailscale peer $hostname | get ipv6)" $hostname ...$ssh_flags
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user