use a match on the OS name

This commit is contained in:
amtoine 2023-04-01 09:05:15 +02:00
parent 9cd3c951f8
commit c6acc47092
No known key found for this signature in database
GPG Key ID: 37AAE9B486CFF1AB

View File

@ -450,15 +450,21 @@ export def clip [
$input | ansi strip $input | ansi strip
} else { $input } } else { $input }
if not (which clip.exe | is-empty) { match $nu.os-info.name {
chcp 65001 # see https://discord.com/channels/601130461678272522/601130461678272524/1085535756237426778 "linux" => {
$input | clip.exe if ($env.WAYLAND_DISPLAY? | is-empty) {
} else if ($env.WAYLAND_DISPLAY? | is-empty) { check-clipboard xclip --system $"('xorg' | pretty-command) on linux"
check-clipboard xclp --system $"('xorg' | pretty-command) on linux" $input | xclip -sel clip
$input | xclip -sel clip } else {
} else { check-clipboard wl-copy --system $"('wayland' | pretty-command) on linux"
check-clipboard wl-copy --system $"('wayland' | pretty-command) on linux" $input | wl-copy
$input | wl-copy }
},
"windows" => {
chcp 65001 # see https://discord.com/channels/601130461678272522/601130461678272524/1085535756237426778
check-clipboard clip.exe --system $"('xorg' | pretty-command) on linux"
$input | clip.exe
},
} }
if not $silent { if not $silent {