tanka
tanka copied to clipboard
`tk env list -l foo=bar` should exit with non-zero code when nothing is found
As per the title, it would be nice for scripting if the command tk env list -l foo=bar
exited with a non-zero code when it can't find anything using the selectors you input. Same logic as for grep
basically.
The --json
option allows to script that. Example:
[[ "$(tk env list --json -l foo=bar | jq length)" == 0 ]] && echo "0 results" || echo "found envs"
You can get rid of jq
by testing for the brackets directly also:
[[ "$(tk env list --json -l foo=bar)" == "[]" ]] && echo "0 results" || echo "found envs"