mirror of https://github.com/bjeanes/dotfiles.git
Add handy utility shell functions for fetching and formatting JSON/XML
parent
b03eb1ee1e
commit
4f55698f60
|
@ -35,3 +35,5 @@ alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
|
||||||
|
|
||||||
alias pubkey="cat $HOME/.ssh/*.pub"
|
alias pubkey="cat $HOME/.ssh/*.pub"
|
||||||
alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors
|
alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors
|
||||||
|
|
||||||
|
alias jsonify='python -mjson.tool'
|
||||||
|
|
|
@ -66,3 +66,19 @@ function command_not_found_handle() {
|
||||||
command_not_found_handler $*
|
command_not_found_handler $*
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function json() {
|
||||||
|
tmpfile=`mktemp -t json`
|
||||||
|
curl -s $* | python -mjson.tool > $tmpfile
|
||||||
|
cat $tmpfile
|
||||||
|
cat $tmpfile | pbcopy
|
||||||
|
rm $tmpfile
|
||||||
|
}
|
||||||
|
|
||||||
|
function xml() {
|
||||||
|
tmpfile=`mktemp -t xml`
|
||||||
|
curl -s $* | xmllint —format - > $tmpfile
|
||||||
|
cat $tmpfile
|
||||||
|
cat $tmpfile | pbcopy
|
||||||
|
rm $tmpfile
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue