Skip to content

Commit

Permalink
updated readme.md and using tab char for formatting with node
Browse files Browse the repository at this point in the history
  • Loading branch information
bobwilliams committed Mar 24, 2014
1 parent 8db3e63 commit f8890f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions plugins/jsontools/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# jsontools

A handy command line tool for dealing with json data.
Handy command line tools for dealing with json data.

## Tools

- **pp_json** - pretty prints json

## Usage

##### pp_json - examples

```sh
# curl json data and pretty print the results
curl https://coderwall.com/bobwilliams.json | pp_json
Expand All @@ -12,4 +18,5 @@ curl https://coderwall.com/bobwilliams.json | pp_json
less data.json | pp_json

# json data directly from the command line
echo '{"b":2, "a":1}' | pp_json
echo '{"b":2, "a":1}' | pp_json
```
2 changes: 1 addition & 1 deletion plugins/jsontools/jsontools.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [[ $(whence $JSONTOOLS_METHOD) = "" ]]; then
fi

if [[ $(whence node) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xnode" ) ]]; then
alias pp_json='node -e "console.log(JSON.stringify(JSON.parse(process.argv[1]), null, 4));"'
alias pp_json='node -e "console.log(JSON.stringify(JSON.parse(process.argv[1]), null, '\t'));"'
elif [[ $(whence python) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xpython" ) ]]; then
alias pp_json='python -mjson.tool'
elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xruby" ) ]]; then
Expand Down

0 comments on commit f8890f5

Please sign in to comment.