mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-12 21:39:48 +01:00
Use $+commands to check the existence of a command in clipboard.zsh. (#5519)
This commit is contained in:
parent
a56eac7a71
commit
f7d4f985ac
1 changed files with 4 additions and 4 deletions
|
@ -31,13 +31,13 @@ function clipcopy() {
|
||||||
cat $file > /dev/clipboard
|
cat $file > /dev/clipboard
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if which xclip &>/dev/null; then
|
if (( $+commands[xclip] )); then
|
||||||
if [[ -z $file ]]; then
|
if [[ -z $file ]]; then
|
||||||
xclip -in -selection clipboard
|
xclip -in -selection clipboard
|
||||||
else
|
else
|
||||||
xclip -in -selection clipboard $file
|
xclip -in -selection clipboard $file
|
||||||
fi
|
fi
|
||||||
elif which xsel &>/dev/null; then
|
elif (( $+commands[xsel] )); then
|
||||||
if [[ -z $file ]]; then
|
if [[ -z $file ]]; then
|
||||||
xsel --clipboard --input
|
xsel --clipboard --input
|
||||||
else
|
else
|
||||||
|
@ -74,9 +74,9 @@ function clippaste() {
|
||||||
elif [[ $OSTYPE == cygwin* ]]; then
|
elif [[ $OSTYPE == cygwin* ]]; then
|
||||||
cat /dev/clipboard
|
cat /dev/clipboard
|
||||||
else
|
else
|
||||||
if which xclip &>/dev/null; then
|
if (( $+commands[xclip] )); then
|
||||||
xclip -out -selection clipboard
|
xclip -out -selection clipboard
|
||||||
elif which xsel &>/dev/null; then
|
elif (( $+commands[xsel] )); then
|
||||||
xsel --clipboard --output
|
xsel --clipboard --output
|
||||||
else
|
else
|
||||||
print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
|
print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
|
||||||
|
|
Loading…
Reference in a new issue