diff --git a/tree/.local/nu/tailscale.nu b/tree/.local/nu/tailscale.nu index 79efc38..82282f5 100644 --- a/tree/.local/nu/tailscale.nu +++ b/tree/.local/nu/tailscale.nu @@ -33,8 +33,26 @@ def "tailscale peer" [ # SSH to a tailscale peer def "tailscale ssh" [ - hostname?: string + hostname: string ...ssh_flags: string ]: nothing -> any { ssh -o $"HostName (tailscale peer $hostname | get ipv6)" $hostname ...$ssh_flags } + +# SCP to a tailscale peer +def "tailscale scp" [ + from: string + to: string + ...ssh_flags: string +]: nothing -> any { + + let options = ( + [$from, $to] | + parse "{hostname}:{path}" | + each { |it| $"HostName (tailscale peer $it.hostname | get ipv6)" } | + each { |option| ["-o", $option] } | + flatten + ) + + scp ...$options $from $to ...$ssh_flags +}