From 5da19a47e43a46ac40c7dc0f1443ccbf5408175a Mon Sep 17 00:00:00 2001 From: Lukas Hoehl Date: Tue, 31 Mar 2026 13:03:41 +0200 Subject: [PATCH 1/4] feat(image): list all Signed-off-by: Lukas Hoehl --- internal/cmd/image/list/list.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/cmd/image/list/list.go b/internal/cmd/image/list/list.go index f30ed8a85..14372840d 100644 --- a/internal/cmd/image/list/list.go +++ b/internal/cmd/image/list/list.go @@ -24,11 +24,13 @@ type inputModel struct { *globalflags.GlobalFlagModel LabelSelector *string Limit *int64 + All *bool } const ( labelSelectorFlag = "label-selector" limitFlag = "limit" + allFlag = "all" ) func NewCmd(params *types.CmdParams) *cobra.Command { @@ -102,6 +104,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command { func configureFlags(cmd *cobra.Command) { cmd.Flags().String(labelSelectorFlag, "", "Filter by label") cmd.Flags().Int64(limitFlag, 0, "Limit the output to the first n elements") + cmd.Flags().Bool(allFlag, false, "List all images available") } func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel, error) { @@ -122,6 +125,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel, GlobalFlagModel: globalFlags, LabelSelector: flags.FlagToStringPointer(p, cmd, labelSelectorFlag), Limit: limit, + All: flags.FlagToBoolPointer(p, cmd, allFlag), } p.DebugInputModel(model) @@ -133,9 +137,13 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APICli if model.LabelSelector != nil { request = request.LabelSelector(*model.LabelSelector) } + if model.All != nil { + request = request.All(*model.All) + } return request } + func outputResult(p *print.Printer, outputFormat string, items []iaas.Image) error { return p.OutputResult(outputFormat, items, func() error { table := tables.NewTable() From 8c1710093f734c4c56751b88f6abdc1f79ab7d76 Mon Sep 17 00:00:00 2001 From: Lukas Hoehl Date: Wed, 1 Apr 2026 16:31:20 +0200 Subject: [PATCH 2/4] examples Signed-off-by: Lukas Hoehl --- internal/cmd/image/list/list.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/cmd/image/list/list.go b/internal/cmd/image/list/list.go index 14372840d..bfd23946b 100644 --- a/internal/cmd/image/list/list.go +++ b/internal/cmd/image/list/list.go @@ -41,7 +41,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command { Args: args.NoArgs, Example: examples.Build( examples.NewExample( - `List all images`, + `List images in your project`, `$ stackit image list`, ), examples.NewExample( @@ -52,6 +52,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { `List the first 10 images`, `$ stackit image list --limit=10`, ), + examples.NewExample( + `List all images`, + `$ stackit image list --all`, + ), ), RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() From cdaabe3e3ff6ea4483aa74541bda909e1fc04825 Mon Sep 17 00:00:00 2001 From: Lukas Hoehl Date: Wed, 1 Apr 2026 16:38:59 +0200 Subject: [PATCH 3/4] print scope and owner Signed-off-by: Lukas Hoehl --- internal/cmd/image/list/list.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/cmd/image/list/list.go b/internal/cmd/image/list/list.go index bfd23946b..e6be6b113 100644 --- a/internal/cmd/image/list/list.go +++ b/internal/cmd/image/list/list.go @@ -151,7 +151,7 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APICli func outputResult(p *print.Printer, outputFormat string, items []iaas.Image) error { return p.OutputResult(outputFormat, items, func() error { table := tables.NewTable() - table.SetHeader("ID", "NAME", "OS", "ARCHITECTURE", "DISTRIBUTION", "VERSION", "LABELS") + table.SetHeader("ID", "NAME", "OS", "ARCHITECTURE", "DISTRIBUTION", "VERSION", "SCOPE", "OWNER", "LABELS") for i := range items { item := items[i] var ( @@ -159,6 +159,8 @@ func outputResult(p *print.Printer, outputFormat string, items []iaas.Image) err os = "n/a" distro = "n/a" version = "n/a" + owner = "n/a" + scope = "n/a" ) if cfg := item.Config; cfg != nil { if v := cfg.Architecture; v != nil { @@ -174,12 +176,21 @@ func outputResult(p *print.Printer, outputFormat string, items []iaas.Image) err version = *v.Get() } } + if v := item.GetOwner(); v != "" { + owner = v + } + if v := item.GetScope(); v != "" { + scope = v + } + table.AddRow(utils.PtrString(item.Id), utils.PtrString(item.Name), os, architecture, distro, version, + scope, + owner, utils.JoinStringKeysPtr(*item.Labels, ",")) } err := table.Display(p) From 5c6d515228d04f2325c9f720076bfece0538fb4e Mon Sep 17 00:00:00 2001 From: Lukas Hoehl Date: Wed, 1 Apr 2026 16:41:45 +0200 Subject: [PATCH 4/4] docs Signed-off-by: Lukas Hoehl --- docs/stackit_image_list.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/stackit_image_list.md b/docs/stackit_image_list.md index eae2a3409..28b759eb0 100644 --- a/docs/stackit_image_list.md +++ b/docs/stackit_image_list.md @@ -13,7 +13,7 @@ stackit image list [flags] ### Examples ``` - List all images + List images in your project $ stackit image list List images with label @@ -21,11 +21,15 @@ stackit image list [flags] List the first 10 images $ stackit image list --limit=10 + + List all images + $ stackit image list --all ``` ### Options ``` + --all List all images available -h, --help Help for "stackit image list" --label-selector string Filter by label --limit int Limit the output to the first n elements