stackit-cli icon indicating copy to clipboard operation
stackit-cli copied to clipboard

cli: --output-format flag is not always honored

Open lilioid opened this issue 5 months ago • 5 comments

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

  1. Run stackit ske cluster list --project-id=… -o json on 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

lilioid avatar Jul 28 '25 13:07 lilioid

Hi @lilioid, thank you for reporting this issue. We will have a look at it.

Fyusel avatar Jul 29 '25 15:07 Fyusel

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

rubenhoenle avatar Sep 05 '25 13:09 rubenhoenle

Hello! It seems this is also the case with stackit auth login - the -o flag does nothing there.

KevinGimbel avatar Sep 16 '25 12:09 KevinGimbel

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

marceljk avatar Sep 16 '25 13:09 marceljk

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!

KevinGimbel avatar Sep 16 '25 14:09 KevinGimbel