diff --git a/README.md b/README.md index baf5b2f..359d05f 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,12 @@ to `$PAGER` (default: more). Also see `readme` and `usage` commands. +### The `json` Command + +Converts input into JSON string using `jq` containing only escaped +(` +`) line returns. + ### Generate `README.md` File ``` @@ -106,5 +112,5 @@ Displays a summary of usage. ---- -*Autogenerated Tue Aug 10 07:37:40 PM EDT 2021* +*Autogenerated Tue Aug 10 09:32:13 PM EDT 2021* diff --git a/command b/command index 7904283..f98bb05 100755 --- a/command +++ b/command @@ -96,6 +96,14 @@ command_bar() { echo "would bar: $*" } +help[json]=' +Converts input into JSON string using `jq` containing only escaped +(`\n`) line returns.' + +command_json() { + _jsonstr "$@" +} + command__hidden() { _filter "$@" && return $? echo "would run _hidden: $*" @@ -186,7 +194,6 @@ command_readme() { echo -e "----\n\n*Autogenerated $(date)*\n" } - _help_title() { _filter "$@" && return $?; local name="$1" @@ -202,6 +209,11 @@ _trim() { echo -e "${it%"${it##*[![:space:]]}"}" } +_jsonstr() { + _buffer "$@" && return $? + jq -MRsc <<< "$1" +} + _have(){ type "$1" &>/dev/null; } _filter(){