add termux commands to clipboard.zsh

This commit is contained in:
j 2017-08-12 15:31:34 -07:00
parent d848c94804
commit a2bd19018b

View File

@ -30,6 +30,17 @@ function clipcopy() {
else else
cat $file > /dev/clipboard cat $file > /dev/clipboard
fi fi
elif [[ $OSTYPE == linux-android ]]; then
if (( $+commands[termux-clipboard-set] )); then
if [[ -z $file ]]; then
termux-clipboard-set
else
cat "$file" | termux-clipboard-set
fi
else
print "clipcopy: termux-api not installed: https://github.com/termux/termux-api-package" >&2
return 1
fi
else else
if (( $+commands[xclip] )); then if (( $+commands[xclip] )); then
if [[ -z $file ]]; then if [[ -z $file ]]; then
@ -73,13 +84,20 @@ function clippaste() {
pbpaste pbpaste
elif [[ $OSTYPE == cygwin* ]]; then elif [[ $OSTYPE == cygwin* ]]; then
cat /dev/clipboard cat /dev/clipboard
elif [[ $OSTYPE == linux-android ]]; then
if (( $+commands[termux-clipboard-get] )); then
termux-clipboard-get
else
print "clippaste: termux-api not installed: https://github.com/termux/termux-api-package" >&2
return 1
fi
else else
if (( $+commands[xclip] )); then if (( $+commands[xclip] )); then
xclip -out -selection clipboard xclip -out -selection clipboard
elif (( $+commands[xsel] )); 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 "clippaste: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
return 1 return 1
fi fi
fi fi