add option to return output as a text instead of array
when you call cli with -o json-path option you always recieve output as an array in brackets. it would be useful to add a key to return output as plain text, so it can used in scripts without further processing (the same way as aws cli does) :
current state :
export org_id=$(atlas organizations list -o json-path='$.results[?(@.name =="MyOrg")].id' )
echo $org_id
[5ccefa1079358eebfef9456e]
suggested output
echo $org_id
5ccefa1079358eebfef9456e
-
Gustavo commented
Hi, it seems like this is a known issue for json-path https://github.com/json-path/JsonPath/issues/272 and when using filters it will always return an array with no way to select only the first element
Right now given this is outside of the control of the CLI I would recommend using json output and an additional tool like jq or using go template outputs until json path addresses this issue