feat: modify sc command to adaptively find clipboard copy executable
All checks were successful
ci / treefmt (push) Successful in 2m12s

This commit is contained in:
Ceferino Patino 2026-06-28 12:40:11 -05:00
commit ad41c9e16a
Signed by: c4patino
SSH key fingerprint: SHA256:Wu+cU1t+7zVT9wzew/4meNmeulo66NzMqc22MdDBgXI

View file

@ -71,12 +71,26 @@ in {
http get $"https://www.toptal.com/developers/gitignore/api/($joined)" http get $"https://www.toptal.com/developers/gitignore/api/($joined)"
} }
def copy-to-clipboard [] {
if ("WSL_DISTRO_NAME" in ($env | columns)) {
clip.exe
} else if (which wl-copy | is-not-empty) {
wl-copy
} else if (which xclip | is-not-empty) {
xclip -selection clipboard
} else if (which pbcopy | is-not-empty) {
pbcopy
} else {
error make {msg: "No clipboard utility found"}
}
}
# secret copy command # secret copy command
def sc [path: string] { def sc [path: string] {
["/run/secrets" ($path)] ["/run/secrets" $path]
| path join | path join
| open | open
| wl-copy | copy-to-clipboard
} }
''; '';