From 9f66059f5294207f302ec028a095a5a9f8699809 Mon Sep 17 00:00:00 2001 From: Gurkirat Singh Date: Sat, 9 Jan 2021 02:29:48 +0530 Subject: [PATCH 1/3] aliases: clipboard: Add more aliases for xclip command Also lint and cleanup the file --- aliases/available/clipboard.aliases.bash | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/aliases/available/clipboard.aliases.bash b/aliases/available/clipboard.aliases.bash index c6c15519c3..f5b2b94243 100644 --- a/aliases/available/clipboard.aliases.bash +++ b/aliases/available/clipboard.aliases.bash @@ -1,20 +1,18 @@ cite 'about-alias' -about-alias 'pbcopy and pbpaste shortcuts to linux' +about-alias 'xclip shortcuts' -case $OSTYPE in - linux*) - XCLIP=$(command -v xclip) - [[ $XCLIP ]] && \ - alias pbcopy="$XCLIP -selection clipboard" && \ - alias pbpaste="$XCLIP -selection clipboard -o" - ;; -esac +if _command_exists xclip; then + alias pbcopy="xclip -selection clipboard" + alias pbpaste="xclip -selection clipboard -o" + alias xcpy="xclip -selection clipboard" + alias xpst="xclip -selection clipboard -o" +fi # to use it just install xclip on your distribution and it would work like: -# $ echo "hello" | pbcopy -# $ pbpaste +# $ echo "hello" | xcpy +# $ xpst # hello # very useful for things like: -# cat ~/.ssh/id_rsa.pub | pbcopy +# cat ~/.ssh/id_rsa.pub | xcpy # have fun! From da662d1332d1837f7b6868154cfc5adc952398f6 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Wed, 13 Jan 2021 18:30:32 +0200 Subject: [PATCH 2/3] aliases: clipboard: Add shellcheck header --- aliases/available/clipboard.aliases.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases/available/clipboard.aliases.bash b/aliases/available/clipboard.aliases.bash index f5b2b94243..d2e8c1eded 100644 --- a/aliases/available/clipboard.aliases.bash +++ b/aliases/available/clipboard.aliases.bash @@ -1,3 +1,4 @@ +# shellcheck shell=bash cite 'about-alias' about-alias 'xclip shortcuts' From 70fa3f8d250b7d192c1aca142d94d2793220dc22 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Wed, 13 Jan 2021 18:43:04 +0200 Subject: [PATCH 3/3] aliases: clipboard: Remove command_exists check --- aliases/available/clipboard.aliases.bash | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/aliases/available/clipboard.aliases.bash b/aliases/available/clipboard.aliases.bash index d2e8c1eded..4c7e6f5bdf 100644 --- a/aliases/available/clipboard.aliases.bash +++ b/aliases/available/clipboard.aliases.bash @@ -2,13 +2,11 @@ cite 'about-alias' about-alias 'xclip shortcuts' -if _command_exists xclip; then - alias pbcopy="xclip -selection clipboard" - alias pbpaste="xclip -selection clipboard -o" +alias pbcopy="xclip -selection clipboard" +alias pbpaste="xclip -selection clipboard -o" - alias xcpy="xclip -selection clipboard" - alias xpst="xclip -selection clipboard -o" -fi +alias xcpy="xclip -selection clipboard" +alias xpst="xclip -selection clipboard -o" # to use it just install xclip on your distribution and it would work like: # $ echo "hello" | xcpy # $ xpst