mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Fix python indentation error.
This commit is contained in:
parent
f498551664
commit
b9d853a8f4
1 changed files with 20 additions and 26 deletions
|
|
@ -1,14 +1,25 @@
|
||||||
# Contributed and SLIGHTLY modded by Matt Parnell/ilikenwf <parwok -at- gmail>
|
# Contributed and SLIGHTLY modded by Matt Parnell/ilikenwf <parwok -at- gmail>
|
||||||
# Created by the blogger at the URL below...I don't know where to find his/her name
|
# Created by the blogger at the URL below...I don't know where to find his/her name
|
||||||
# Original found at http://www.shellperson.net/sprunge-pastebin-script/
|
# Original found at http://www.shellperson.net/sprunge-pastebin-script/
|
||||||
|
#
|
||||||
|
# Modified by Evaryont to:
|
||||||
|
# - Detect syntax via pygments
|
||||||
|
# - Behave nicely as a plugin
|
||||||
|
|
||||||
usage() {
|
sprunge() {
|
||||||
description | fmt -s >&2
|
if [ -t 0 ]; then
|
||||||
}
|
if [ "$*" ]; then
|
||||||
|
if [ -f "$*" ]; then
|
||||||
description() {
|
# Use python to attempt to detect the syntax
|
||||||
|
syntax=$(echo "try:
|
||||||
|
from pygments.lexers import get_lexer_for_filename
|
||||||
|
print(get_lexer_for_filename('$*').aliases[0])
|
||||||
|
except:
|
||||||
|
print('text')" | python)
|
||||||
|
url=$(cat "$*" | curl -F 'sprunge=<-' http://sprunge.us)
|
||||||
|
fi
|
||||||
|
else
|
||||||
cat << HERE
|
cat << HERE
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Upload data and fetch URL from the pastebin http://sprunge.us
|
Upload data and fetch URL from the pastebin http://sprunge.us
|
||||||
|
|
||||||
|
|
@ -34,25 +45,8 @@ In this example, the contents of file_as_stdin_redirection.txt would be uploaded
|
||||||
If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it.
|
If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it.
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
|
|
||||||
HERE
|
HERE | fmt -s >&2
|
||||||
exit
|
return 0
|
||||||
}
|
|
||||||
|
|
||||||
sprunge() {
|
|
||||||
if [ -t 0 ]; then
|
|
||||||
if [ "$*" ]; then
|
|
||||||
if [ -f "$*" ]; then
|
|
||||||
# Use python to attempt to detect the syntax
|
|
||||||
syntax=$(echo "
|
|
||||||
try:
|
|
||||||
from pygments.lexers import get_lexer_for_filename
|
|
||||||
print(get_lexer_for_filename('$*').aliases[0])
|
|
||||||
except:
|
|
||||||
print('text')" | python)
|
|
||||||
url=$(cat "$*" | curl -F 'sprunge=<-' http://sprunge.us)
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
usage
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
syntax="text" # We're dumb in this mode. So, dumb syntax highlighting!
|
syntax="text" # We're dumb in this mode. So, dumb syntax highlighting!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue