diff options
author | Aaron N. Brock <AaronNBrock@gmail.com> | 2019-11-22 10:40:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-22 10:40:37 -0500 |
commit | 420e9d789a26223df9dd7df7625daf032a3f5083 (patch) | |
tree | 0ccfcd55671fd4d68b61a91188c984563384ee30 /plugins/jsontools | |
parent | 5722677884e85ae910daab4b4624745af74540e6 (diff) | |
parent | 76d6b0256398ad1becbc304a78f51bbacfee50e5 (diff) | |
download | zsh-420e9d789a26223df9dd7df7625daf032a3f5083.tar.gz zsh-420e9d789a26223df9dd7df7625daf032a3f5083.tar.bz2 zsh-420e9d789a26223df9dd7df7625daf032a3f5083.zip |
Merge branch 'master' into colorize-chroma-support
Diffstat (limited to 'plugins/jsontools')
-rw-r--r-- | plugins/jsontools/jsontools.plugin.zsh | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/jsontools/jsontools.plugin.zsh b/plugins/jsontools/jsontools.plugin.zsh index 20d5eb1c9..912c83509 100644 --- a/plugins/jsontools/jsontools.plugin.zsh +++ b/plugins/jsontools/jsontools.plugin.zsh @@ -11,9 +11,10 @@ if [[ $(whence node) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METH alias urlencode_json='xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"' alias urldecode_json='xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"' elif [[ $(whence python) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xpython" ) ]]; then - alias pp_json='python -mjson.tool' + alias pp_json='python -c "import sys; del sys.path[0]; import runpy; runpy._run_module_as_main(\"json.tool\")"' alias is_json='python -c " -import json, sys; +import sys; del sys.path[0]; +import json; try: json.loads(sys.stdin.read()) except ValueError, e: @@ -22,11 +23,13 @@ else: print True sys.exit(0)"' alias urlencode_json='python -c " -import urllib, json, sys; +import sys; del sys.path[0]; +import urllib, json; print urllib.quote_plus(sys.stdin.read()) sys.exit(0)"' alias urldecode_json='python -c " -import urllib, json, sys; +import sys; del sys.path[0]; +import urllib, json; print urllib.unquote_plus(sys.stdin.read()) sys.exit(0)"' elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xruby" ) ]]; then @@ -36,4 +39,4 @@ elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_MET alias urldecode_json='ruby -e "require \"uri\"; puts URI.unescape(STDIN.read)"' fi -unset JSONTOOLS_METHOD
\ No newline at end of file +unset JSONTOOLS_METHOD |