SalesforceCommerceCloud / sfcc-ci

Salesforce Commerce Cloud CLI
https://npmjs.com/package/sfcc-ci
BSD 3-Clause "New" or "Revised" License
229 stars 91 forks source link

Remove or convert console output to JSON when --json is given #22

Open wundrian opened 5 years ago

wundrian commented 5 years ago

When working non-interactively by calling the sfcc-ci program and specifying --json, for example like in the following case:

docker run docker-registry.releng.demandware.net/ccdx/dx-sfcc-ci:1.1.4-mbickel.refresh sandbox:list --json

The output may not be entirely json, for example when the authentication renewal kicks in and prints "Authentication succeeded" messages via calls to console.info to stdout.

This requires me to parse the stdout to figure out where the JSON object begins.

Can we change this so when --json is given, output is guaranteed to be a JSON object with any non-json output redirected to stderr, if necessary?

tobiaslohr commented 5 years ago

I like the idea, and this makes sense of course. Any error message put to the console out is done through console.error(..), which should land into stderr already.

Do you still expect these error messages to be present in the json string of stdout? Some commands support this already. If yes, what is the format you'd expect? E.g. any error message(s) concatenated into a single error property?

For non-error messages, how do you expect this to be present, e.g. auto-renewal message?