mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Capture url output, output syntax if we know what it is.
This commit is contained in:
parent
d8d7b45f96
commit
f498551664
1 changed files with 10 additions and 3 deletions
|
|
@ -49,14 +49,21 @@ sprunge() {
|
||||||
print(get_lexer_for_filename('$*').aliases[0])
|
print(get_lexer_for_filename('$*').aliases[0])
|
||||||
except:
|
except:
|
||||||
print('text')" | python)
|
print('text')" | python)
|
||||||
cat "$*" | curl -F 'sprunge=<-' http://sprunge.us
|
url=$(cat "$*" | curl -F 'sprunge=<-' http://sprunge.us)
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
while read -r line ; do
|
syntax="text" # We're dumb in this mode. So, dumb syntax highlighting!
|
||||||
|
url=$(while read -r line ; do
|
||||||
echo $line
|
echo $line
|
||||||
done | curl -F 'sprunge=<-' http://sprunge.us
|
done | curl -F 'sprunge=<-' http://sprunge.us)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$syntax" -ne "text" ]; then
|
||||||
|
echo "$url?$syntax"
|
||||||
|
else
|
||||||
|
echo $url
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue