Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/lib/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ REMOTE Remote host

---

## ppretty-json

Pretty prints JSON string. Can accept JSON from stdin also so it's great to use in a pipe.

**Usage**

```
ppretty-json [JSON]

Params:
JSON JSON string. If not supplied read from stdin.
```

---

## ppretty-php

Pretty prints a serialized PHP object/array. Can accept serial string from stdin also so it's great to use in a pipe.
Expand Down
12 changes: 12 additions & 0 deletions lib/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ echo "\n";
EOF
}

## Pretty print JSON
##
## @param $1 JSON string
###########################
ppretty-json() {
local serial="${1:-}"
[[ -z "${serial}" ]] && read -r serial

echo
jq '.' <<<"${serial}"
}

## Bump version (for semantic versioning)
##
## @param $1 Current version
Expand Down