summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Ørsted Andresen <bo.andresen@zlin.dk>2007-09-19 04:18:05 +0000
committerBo Ørsted Andresen <bo.andresen@zlin.dk>2007-09-19 04:18:05 +0000
commitfc7b27e5ab23e77144ec6633f7a458667dca1106 (patch)
treef0d5b6a9bf11262b39a62f135d3dd36aa19239b3
parentdb3e15080734493ea53e2636496b31a2c004d82a (diff)
downloadwgetpaste-fc7b27e5ab23e77144ec6633f7a458667dca1106.tar.gz
Collapse two almost identical error messages into one.
-rwxr-xr-xwgetpaste26
1 files changed, 12 insertions, 14 deletions
diff --git a/wgetpaste b/wgetpaste
index f0ca9d5..44aa2a0 100755
--- a/wgetpaste
+++ b/wgetpaste
@@ -21,17 +21,21 @@ escape() {
### default clipboard functions
+noxclip() {
+ cat <<EOF >&2
+Could not find xclip on your system. In order to use --x$1 you must
+either emerge x11-misc/xclip or define $2_clipboard() globally in
+/etc/wgetpaste or per user in ~/.wgetpaste to use another program
+(such as xcut or klipper) to $3 your clipboard.
+EOF
+ exit 1
+}
+
get_from_clipboard() {
if [[ -x $(type -P xclip) ]]; then
xclip -o
else
- cat <<EOF >&2
-Could not find xclip on your system. In order to use --xcut you must
-either emerge x11-misc/xclip or define get_from_clipboard() globally in
-/etc/wgetpaste or per user in ~/.wgetpaste to use another program
-(such as xcut or klipper) to read from your clipboard.
-EOF
- exit 1
+ noxclip cut get_from "read from"
fi
}
@@ -39,13 +43,7 @@ add_to_clipboard() {
if [[ -x $(type -P xclip) ]]; then
xclip -loops 10 <<< "$*"
else
- cat <<EOF >&2
-Could not find xclip on your system. In order to use --xpaste you must
-either emerge x11-misc/xclip or define add_to_clipboard() globally in
-/etc/wgetpaste or per user in ~/.wgetpaste to use another program
-(such as xcut or klipper) to write to your clipboard.
-EOF
- exit 1
+ noxclip paste add_to "write to"
fi
}