fastly/cli

--json should imply --quiet

Closed this issue · 0 comments

Version

% fastly version
Fastly CLI version v10.12.1 (4aecc677)
Built with go version go1.22.3 linux/amd64 (2024-07-16)
Viceroy version: viceroy 0.9.7

A new version of the Fastly CLI is available.
Current version: 10.12.1
Latest version: 10.12.3
Run `fastly update` to get the latest version.

However the issue still exists after upgrading to 10.12.3.

What happened

The --json command line option that is available for many (most?) commands is meant to be consumed directly from tools that expect JSON. However, if you’re not on the current version of the CLI, the CLI displays a message A new version of Fastly CLI is available at the end of stdout. This makes the JSON invalid and tools that expect JSON will fail.
The --quiet option can used to suppress messages such as those, so --json should also imply --quiet.

% fastly products --json                    
{
  "brotli_compression": false,
  "domain_inspector": false,
  "fanout": true,
  "image_optimizer": false,
  "origin_inspector": false,
  "websockets": false
}

A new version of the Fastly CLI is available.
Current version: 10.12.1
Latest version: 10.12.3
Run `fastly update` to get the latest version.