feat: modify sc command to adaptively find clipboard copy executable
All checks were successful
ci / treefmt (push) Successful in 2m12s
All checks were successful
ci / treefmt (push) Successful in 2m12s
This commit is contained in:
parent
ba2d4e8e7b
commit
ad41c9e16a
1 changed files with 16 additions and 2 deletions
|
|
@ -71,12 +71,26 @@ in {
|
|||
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
|
||||
def sc [path: string] {
|
||||
["/run/secrets" ($path)]
|
||||
["/run/secrets" $path]
|
||||
| path join
|
||||
| open
|
||||
| wl-copy
|
||||
| copy-to-clipboard
|
||||
}
|
||||
'';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue