A simple command that allows you to modify .json files with the provided key value arguments. Usefull if you want to modify config files in command line or with bash scripts.
run go get github.com/0nedark/shape
--file value
, -f value
- specifies the file to be modified
--mutable
, -m
- allow adding of new keys to the file
Initial JSON
{"loglevel":"info","env":"stg"}
update single key
shape -f ./config.json loglevel=debug
{"loglevel":"debug","env":"stg"}
update multiple keys
shape -f ./config.json loglevel=debug env=dev
{"loglevel":"debug","env":"dev"}
add new key
shape -m -f ./config.json example=a
{"loglevel":"info","env":"stg","example":"a"}