From 3fd0b5a647bb2cb296c926eab4d11ac4c761e1eb Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Sun, 8 Jun 2025 14:11:03 +0200 Subject: [PATCH] nu: Add `tailscale scp` command --- tree/.local/nu/tailscale.nu | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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 +}