Fix user field in tailscale scp
This commit is contained in:
@ -36,12 +36,8 @@ def "tailscale ssh" [
|
|||||||
user_hostname: string
|
user_hostname: string
|
||||||
...ssh_flags: string
|
...ssh_flags: string
|
||||||
]: nothing -> any {
|
]: nothing -> any {
|
||||||
if "@" in $user_hostname {
|
let hostname = ($user_hostname | parse -r "([^@]*@)?(?<hostname>.*)" | get 0.hostname)
|
||||||
let parsed = ($user_hostname | parse "{user}@{hostname}" | first)
|
ssh -o $"HostName (tailscale peer $hostname | get ipv6)" $user_hostname ...$ssh_flags
|
||||||
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
|
# SCP to a tailscale peer
|
||||||
@ -53,7 +49,7 @@ def "tailscale scp" [
|
|||||||
|
|
||||||
let options = (
|
let options = (
|
||||||
[$from, $to] |
|
[$from, $to] |
|
||||||
parse "{hostname}:{path}" |
|
parse -r "([^@]*@)?(?<hostname>.*):(?<path>.*)" |
|
||||||
each { |it| $"HostName (tailscale peer $it.hostname | get ipv6)" } |
|
each { |it| $"HostName (tailscale peer $it.hostname | get ipv6)" } |
|
||||||
each { |option| ["-o", $option] } |
|
each { |option| ["-o", $option] } |
|
||||||
flatten
|
flatten
|
||||||
|
|||||||
Reference in New Issue
Block a user