Skip to content
/ jq-shell Public

Functions for making json structures useful to shell

License

Notifications You must be signed in to change notification settings

xPMo/jq-shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

JQ - Shell Functions

param

Convert json objects into shell parameter declarations:

jq -r 'import "shell" as sh; sh::param' << 'EOF'
{
  "my-assoc": {
    "k1": "val",
    "k2": "val"
  },
  "my-array": [
    "foo",
    "bar",
    "baz"
  ],
  "my-string": "string",
  "my-int": 42,
  "my-float": 3.14
}
[
  "what about",
  "an array?"
]
EOF
typeset -A _myassoc=(['k1']='val' ['k2']='val')
typeset -a _myarray=('foo' 'bar' 'baz')
typeset _mystring='string'
typeset -i _myint=42
[[ -v ZSH_ARGZERO ]] && typeset -F _myfloat=3.14
set -- 'what about' 'an array?'

Installation

Copy/Symlink shell.jq into your ~/.jq directory.

About

Functions for making json structures useful to shell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages