diff options
author | Bo Ørsted Andresen <zlin@exherbo.org> | 2009-01-23 06:45:32 +0100 |
---|---|---|
committer | Bo Ørsted Andresen <zlin@exherbo.org> | 2009-01-28 10:31:33 +0100 |
commit | b02c7273d7e28439f64158ee4c81fba340cff428 (patch) | |
tree | 058eeea3fc76a70c0be2073292f97459ffeabfc2 | |
parent | 225f42b9e05a554cf722d0d630a87d33a8ace08c (diff) | |
download | wgetpaste-b02c7273d7e28439f64158ee4c81fba340cff428.tar.gz |
Use one x_paste() function for --xpaste and --xclippaste.
Plus a few minor tweaks.
-rwxr-xr-x | wgetpaste | 21 |
1 files changed, 6 insertions, 15 deletions
@@ -264,7 +264,7 @@ Usage: $0 [options] [file[s]] Options: -l, --language LANG set language (defaults to "$DEFAULT_LANGUAGE") -d, --description DESCRIPTION set description (defaults to "stdin" or filename) - -n, --nick NICK set nick (defaults to your username)) + -n, --nick NICK set nick (defaults to your username) -s, --service SERVICE set service to use (defaults to "$DEFAULT_SERVICE") -e, --expiration EXPIRATION set when it should expire (defaults to "$DEFAULT_EXPIRATION") @@ -350,26 +350,18 @@ showexpirations() { showurl() { echo "Your ${2}paste can be seen here: $1" - [[ $XPASTE ]] && x_paste "$1" - [[ $XCLIPPASTE ]] && x_clip_paste "$1" + [[ $XPASTE ]] && x_paste "$1" primary + [[ $XCLIPPASTE ]] && x_paste "$1" clipboard } x_paste() { if [[ -x $(type -P xclip) ]]; then - echo -n "$*" | xclip -selection primary -loops 10 &>/dev/null || die "xclip failed." + echo -n "$1" | xclip -selection $2 -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 @@ -556,11 +548,10 @@ load_configs() { for f in {/etc/,~/.}wgetpaste{.d/*.bash,}; do if [[ -f $f ]]; then if [[ -z $deprecated ]]; then - echo "The config files for wgetpaste have changed to *.conf." >&2 - echo >&2 + echo "The config files for wgetpaste have changed to *.conf.$N" >&2 deprecated=0 fi - echo "Please move ${f} to ${f%.bash}.conf" >&2 + echo "Please move ${f} to ${f/%.bash/.conf}" >&2 source "$f" || die "Failed to source $f" fi done |