cli: --output-format flag is not always honored
Description
The --output-format flag is not always honored.
For example, if one runs a stackit ske cluster list -o json on a project that has SKE enabled but where no clusters yet exist, the CLI only outputs a plaintext error.
With the current behavior, it is not easily possible to use the STACKIT cli in scripts because one cannot always parse the output correctly.
Steps to reproduce
- Run
stackit ske cluster list --project-id=… -o jsonon a project where SKE is enabled but where no cluster has yet been created
Actual behavior
The CLI exits with exit code 0 (which is fine) and the following plaintext output:
No clusters found for project "…"
Expected behavior
The CLI should exit with code 0 and print [] to stdout.
Environment
- OS: Linux
- Version of STACKIT CLI (see
stackit --version):v0.32.0
Hi @lilioid, thank you for reporting this issue. We will have a look at it.
Hi @lilioid,
just wanted to let you know that we fixed this for SKE (https://github.com/stackitcloud/stackit-cli/commit/a0eee4ef7bbed38042fa10dc99d0533166671142) and we're working on fixing it for all other list commands also :)
Best regards Ruben
Hello! It seems this is also the case with stackit auth login - the -o flag does nothing there.
Hi @KevinGimbel,
what would be the expected result for you, when running $ stackit auth login with the output flag?
When you need the access token, you can also use $ stackit auth get-access-token -o json.
Best regards, Marcel
I expected to get a credentials.json which i could store into a file -- I guess get-access-token is what I should be using instead!