Parse user in tailscale ssh nu command
This commit is contained in:
@ -33,10 +33,15 @@ def "tailscale peer" [
|
||||
|
||||
# SSH to a tailscale peer
|
||||
def "tailscale ssh" [
|
||||
hostname: string
|
||||
user_hostname: string
|
||||
...ssh_flags: string
|
||||
]: nothing -> any {
|
||||
ssh -o $"HostName (tailscale peer $hostname | get ipv6)" $hostname ...$ssh_flags
|
||||
if "@" in $user_hostname {
|
||||
let parsed = ($user_hostname | parse "{user}@{hostname}" | first)
|
||||
ssh -o $"HostName (tailscale peer $parsed.hostname | get ipv6)" $user_hostname ...$ssh_flags
|
||||
} else {
|
||||
ssh -o $"HostName (tailscale peer $user_hostname | get ipv6)" $user_hostname ...$ssh_flags
|
||||
}
|
||||
}
|
||||
|
||||
# SCP to a tailscale peer
|
||||
@ -47,7 +52,7 @@ def "tailscale scp" [
|
||||
]: nothing -> any {
|
||||
|
||||
let options = (
|
||||
[$from, $to] |
|
||||
[$from, $to] |
|
||||
parse "{hostname}:{path}" |
|
||||
each { |it| $"HostName (tailscale peer $it.hostname | get ipv6)" } |
|
||||
each { |option| ["-o", $option] } |
|
||||
|
||||
Reference in New Issue
Block a user