mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
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.
This commit is contained in:
parent
69c6c04f64
commit
38da730806
1 changed files with 5 additions and 12 deletions
|
|
@ -6,19 +6,12 @@
|
||||||
|
|
||||||
sprunge_usage() {
|
sprunge_usage() {
|
||||||
cat << HERE
|
cat << HERE
|
||||||
|
Usage:
|
||||||
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
|
|
||||||
sprunge [files]
|
sprunge [files]
|
||||||
sprunge < file
|
sprunge < file
|
||||||
piped_data | sprunge
|
piped_data | sprunge
|
||||||
|
|
||||||
|
Upload data and fetch URL from the pastebin http://sprunge.us.
|
||||||
HERE
|
HERE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,12 +32,12 @@ sprunge() {
|
||||||
|
|
||||||
urls=()
|
urls=()
|
||||||
|
|
||||||
if [[ ! -t 0 ]]; then
|
if [[ ! -t 0 || $#argv -eq 0 ]]; then
|
||||||
url=$(curl -s -F 'sprunge=<-' http://sprunge.us <& 0)
|
url=$(curl -s -F 'sprunge=<-' http://sprunge.us <& 0)
|
||||||
urls=(${url//[[:space:]]})
|
urls=(${url//[[:space:]]})
|
||||||
elif [[ $#argv -eq 0 ]]; then
|
elif [[ $1 == '-h' || $1 == '--help' ]]; then
|
||||||
sprunge_usage
|
sprunge_usage
|
||||||
return 1
|
return 0
|
||||||
else
|
else
|
||||||
# Use python to attempt to detect the syntax
|
# Use python to attempt to detect the syntax
|
||||||
for file in $@; do
|
for file in $@; do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue