akamai/cli-dns

Suppress Spinner Text For Valid JSON output

Opened this issue · 2 comments

When adding --json for JSON formatted output, the akamai.StartSpinner() outputs text that is not valid JSON.

This greatly diminishes the ability for other scripts and programs to leverage native JSON output without first storing it as a flat file with --output or having some additional parsing.

Example:

» akamai dns list-recordsets FQDN_TLD --json                  
Retrieving Recordsets List ... [OK]
Assembling Recordsets List ... [OK]

{
  "Recordsets": [
    {
      "name": "FQDN_TLD",
      "type": "A",
      "ttl": 600,
      "rdata": [
        "1.1.1.1"
      ]
    }
  ]
}

It would be nice to have a global flag or config option to supress the functions defined in: https://github.com/akamai/cli-common-golang/blob/master/spinner.go

I am happy to help make this change and work with Contributors on the implementation details.

I am also unsure if this would fit in with the main CLI, the shared common lib, or within this DNS package.

+1, please.

Generating json output and then having non-json output interspersed means I can't actually post-process the json data.

Maybe this sort of message should go to stderr, not stdout.