From 38da730806fabea461a885de34f7e2dacef3742f Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Tue, 29 Nov 2011 12:33:29 -0500 Subject: [PATCH] Updated sprunge so if its called without any arguments it will read from stdin. To get help, use -h or --help. Also, we really don't need the massive wall of text for usage help. --- plugins/sprunge/sprunge.plugin.zsh | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/plugins/sprunge/sprunge.plugin.zsh b/plugins/sprunge/sprunge.plugin.zsh index 71b784bd9..6a9530ec0 100644 --- a/plugins/sprunge/sprunge.plugin.zsh +++ b/plugins/sprunge/sprunge.plugin.zsh @@ -6,19 +6,12 @@ sprunge_usage() { cat << HERE - -DESCRIPTION - Upload data and fetch URL from the pastebin http://sprunge.us - - In addition to printing the returned URL, if the xset or xsel - programs are available, the URL will also be copied to the - PRIMARY selection and the CLIPBOARD selection. - -USAGE +Usage: sprunge [files] sprunge < file piped_data | sprunge +Upload data and fetch URL from the pastebin http://sprunge.us. HERE } @@ -39,12 +32,12 @@ sprunge() { urls=() - if [[ ! -t 0 ]]; then + if [[ ! -t 0 || $#argv -eq 0 ]]; then url=$(curl -s -F 'sprunge=<-' http://sprunge.us <& 0) urls=(${url//[[:space:]]}) - elif [[ $#argv -eq 0 ]]; then + elif [[ $1 == '-h' || $1 == '--help' ]]; then sprunge_usage - return 1 + return 0 else # Use python to attempt to detect the syntax for file in $@; do