commit b0519c860193a7c7bd56357564c4722edf1eed66
parent 834337af6b59e29891fb98a318a15dee76cec3be
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Wed, 26 Aug 2020 23:15:25 +0200
clip: renamed scripts
Former-commit-id: 54cf7cfa56dbbb54a6f0085960737a47b8b25225
Diffstat:
6 files changed, 77 insertions(+), 77 deletions(-)
diff --git a/scripts/clc b/scripts/clc
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+# clc - Copy data to clipboard
+#
+# Usage:
+#
+# <command> | clc - copies stdin to clipboard
+#
+# clc <file> - copies a file's contents to clipboard
+#
+file=$1
+if [[ $OSTYPE == darwin* ]]; then
+ if [[ -z $file ]]; then
+ pbcopy
+ else
+ pbcopy < "$file"
+ fi
+elif [[ $OSTYPE == cygwin* || $OSTYPE == msys* ]]; then
+ if [[ -z "$file" ]]; then
+ cat > /dev/clipboard
+ else
+ cat "$file" > /dev/clipboard
+ fi
+else
+ if command -v xclip &>/dev/null; then
+ if [[ -z $file ]]; then
+ xclip -in -selection clipboard
+ else
+ xclip -in -selection clipboard "$file"
+ fi
+ elif command -v xsel &>/dev/null; then
+ if [[ -z $file ]]; then
+ xsel --clipboard --input
+ else
+ cat "$file" | xsel --clipboard --input
+ fi
+ else
+ print "clc: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
+ return 1
+ fi
+fi
diff --git a/scripts/clipcopy b/scripts/clipcopy
@@ -1,40 +0,0 @@
-#!/usr/bin/env bash
-# clipcopy - Copy data to clipboard
-#
-# Usage:
-#
-# <command> | clipcopy - copies stdin to clipboard
-#
-# clipcopy <file> - copies a file's contents to clipboard
-#
-file=$1
-if [[ $OSTYPE == darwin* ]]; then
- if [[ -z $file ]]; then
- pbcopy
- else
- pbcopy < "$file"
- fi
-elif [[ $OSTYPE == cygwin* || $OSTYPE == msys* ]]; then
- if [[ -z "$file" ]]; then
- cat > /dev/clipboard
- else
- cat "$file" > /dev/clipboard
- fi
-else
- if command -v xclip &>/dev/null; then
- if [[ -z $file ]]; then
- xclip -in -selection clipboard
- else
- xclip -in -selection clipboard "$file"
- fi
- elif command -v xsel &>/dev/null; then
- if [[ -z $file ]]; then
- xsel --clipboard --input
- else
- cat "$file" | xsel --clipboard --input
- fi
- else
- print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
- return 1
- fi
-fi
diff --git a/scripts/clippaste b/scripts/clippaste
@@ -1,32 +0,0 @@
-#!/usr/bin/env bash
-# clippaste - "Paste" data from clipboard to stdout
-#
-# Usage:
-#
-# clippaste - writes clipboard's contents to stdout
-#
-# clippaste | <command> - pastes contents and pipes it to another process
-#
-# clippaste > <file> - paste contents to a file
-#
-# Examples:
-#
-# # Pipe to another process
-# clippaste | grep foo
-#
-# # Paste to a file
-# clippaste > file.txt
-if [[ $OSTYPE == darwin* ]]; then
- pbpaste
-elif [[ $OSTYPE == cygwin* || $OSTYPE == msys* ]]; then
- cat /dev/clipboard
-else
- if command -v xclip &>/dev/null; then
- xclip -out -selection clipboard
- elif command -v xsel &>/dev/null; then
- xsel --clipboard --output
- else
- print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
- return 1
- fi
-fi
diff --git a/scripts/clp b/scripts/clp
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+# clp - "Paste" data from clipboard to stdout
+#
+# Usage:
+#
+# clp - writes clipboard's contents to stdout
+#
+# clp | <command> - pastes contents and pipes it to another process
+#
+# clp > <file> - paste contents to a file
+#
+# Examples:
+#
+# # Pipe to another process
+# clp | grep foo
+#
+# # Paste to a file
+# clp > file.txt
+if [[ $OSTYPE == darwin* ]]; then
+ pbpaste
+elif [[ $OSTYPE == cygwin* || $OSTYPE == msys* ]]; then
+ cat /dev/clipboard
+else
+ if command -v xclip &>/dev/null; then
+ xclip -out -selection clipboard
+ elif command -v xsel &>/dev/null; then
+ xsel --clipboard --output
+ else
+ print "clc: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
+ return 1
+ fi
+fi
diff --git a/scripts/upload b/scripts/upload
@@ -3,8 +3,8 @@ if ! command -v curl 1>/dev/null 2>&1; then
echo "curl not installed." >&2
exit 1
fi
-if ! command -v clipcopy 1>/dev/null 2>&1; then
- echo "clipcopy script not present." >&2
+if ! command -v clc 1>/dev/null 2>&1; then
+ echo "clc script not present." >&2
exit 1
fi
@@ -17,6 +17,6 @@ die() {
[ -f "$1" ] || die "File $1 does not exist."
response=$(curl -s -F file=@"$1" http://0x0.st)
printf 'Response: %s' "$response"
-{ printf '%s' "$response" | sed 's/^.*\(http[^"]*\).*/\1/' | clipcopy; } || echo "Direct link copied to clipboard."
+{ printf '%s' "$response" | sed 's/^.*\(http[^"]*\).*/\1/' | clc; } || echo "Direct link copied to clipboard."
diff --git a/sxiv/exec/key-handler b/sxiv/exec/key-handler
@@ -3,8 +3,8 @@ while read file; do
fullpath="$(pwd)$file"
case "$1" in
"y")
- printf "$file" | clipcopy;;
+ printf "$file" | clc;;
"Y")
- printf "$fullpath" | clipcopy;;
+ printf "$fullpath" | clc;;
esac
done