starphleet
starphleet copied to clipboard
improved error messages for fromJson
I made the errors from fromJson
more informative:
➜ starphleet git:(sixteen-oh-four) ✗ bash meh.sh test
fromJson(meh.sh): error reading key (test) from json ({"json":"here","cat":"pants"})
➜ starphleet git:(better-error-msgs) bash meh.sh cat
fromJson(meh.sh): This isn't json! -- {"not": "json"
The goal was for the file name to be the orders
file, but I'm not really sure how it's called or if that is the first (0th) parameter even. It was an attempt at making the messages more meaningful.
FYI This is the contents of meh.sh
which I assume sort of mimics the way orders
are run, but I'm not a starphleet-ologist yet so ¯\_(ツ)_/¯ :
source ~/.functions
from-json '{"json":"here","cat":"pants"}' $1