nu: Add tailscale scp command
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user