diff options
author | Bo Ørsted Andresen <bo.andresen@zlin.dk> | 2008-08-25 22:13:57 +0000 |
---|---|---|
committer | Bo Ørsted Andresen <bo.andresen@zlin.dk> | 2008-09-03 02:23:23 +0200 |
commit | 9ee9ce00bdaabfa4dee14cfce6025ca9cb7f37aa (patch) | |
tree | c14ec0d3c184f642482b106a2ebfb5b8519938f8 | |
parent | 64176d00126c64616ae1bdaa224c95ff1b6f0da4 (diff) | |
download | wgetpaste-9ee9ce00bdaabfa4dee14cfce6025ca9cb7f37aa.tar.gz |
Add -C, --xclippaste option to paste to clipboard selection buffer. Make -X, --xpaste explicitly paste to primary selection buffer. Use echo -n to avoid adding a trailing \n when pasting. Thanks to Jesús Guerrero for providing this patch.
-rwxr-xr-x | wgetpaste | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -251,7 +251,8 @@ Options: -i, --info append the output of \`$INFO_COMMAND\` -I, --info-only paste the output of \`$INFO_COMMAND\` only -x, --xcut read input from clipboard (requires x11-misc/xclip) - -X, --xpaste write resulting url to clipboard (requires x11-misc/xclip) + -X, --xpaste write resulting url to the X primary selection buffer (requires x11-misc/xclip) + -C, --xclippaste write resulting url to the X clipboard selection buffer (requires x11-misc/xclip) -r, --raw show url for the raw paste (no syntax highlighting or html) -t, --tee use tee to show what is being pasted @@ -320,16 +321,25 @@ showexpirations() { showurl() { echo "Your ${2}paste can be seen here: $1" [[ $XPASTE ]] && x_paste "$1" + [[ $XCLIPPASTE ]] && x_clip_paste "$1" } x_paste() { if [[ -x $(type -P xclip) ]]; then - xclip -loops 10 &>/dev/null <<< "$*" || die "xclip failed." + echo -n "$*" | xclip -selection primary -loops 10 &>/dev/null || die "xclip failed." else noxclip paste "write to" fi } +x_clip_paste() { + if [[ -x $(type -P xclip) ]]; then + echo -n "$*" | xclip -selection clipboard -loops 10 &>/dev/null || die "xclip failed." + else + noxclip clip_paste "write to" + fi +} + ### Posting helper functions # get the url to post to @@ -495,6 +505,9 @@ while [[ -n $1 ]]; do -X | --xpaste ) XPASTE=0 ;; + -C | --xclippaste ) + XCLIPPASTE=0 + ;; -* ) die "$0: unrecognized option \`$1'" ;; |