akamai / cli-dns

Akamai CLI for Edge DNS
Apache License 2.0
9 stars 7 forks source link

Suppress Spinner Text For Valid JSON output #20

Open joeygrasso opened 5 months ago

joeygrasso commented 5 months ago

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

joeygrasso commented 5 months ago

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.

jschauma commented 2 weeks ago

+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.