@@ -12,6 +12,7 @@ import (
1212 "github.com/stackitcloud/stackit-cli/internal/pkg/examples"
1313 "github.com/stackitcloud/stackit-cli/internal/pkg/flags"
1414 "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
15+ "github.com/stackitcloud/stackit-cli/internal/pkg/print"
1516 "github.com/stackitcloud/stackit-cli/internal/pkg/projectname"
1617 "github.com/stackitcloud/stackit-cli/internal/pkg/services/alb/client"
1718 "github.com/stackitcloud/stackit-cli/internal/pkg/tables"
@@ -54,7 +55,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
5455 }
5556
5657 // Configure API client
57- apiClient , err := client .ConfigureClient (params .Printer , cmd )
58+ apiClient , err := client .ConfigureClient (params .Printer , params . CliVersion )
5859 if err != nil {
5960 return err
6061 }
@@ -66,7 +67,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
6667 return fmt .Errorf ("(...): %w" , err )
6768 }
6869
69- projectLabel , err := projectname .GetProjectName (ctx , params .Printer , cmd )
70+ projectLabel , err := projectname .GetProjectName (ctx , params .Printer , params . CliVersion , cmd )
7071 if err != nil {
7172 projectLabel = model .ProjectId
7273 }
@@ -86,22 +87,22 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
8687
8788// Configure command flags (type, default value, and description)
8889func configureFlags (cmd * cobra.Command ) {
89- cmd .Flags ().StringP (myFlag , "defaultValue" , "My flag description" )
90+ cmd .Flags ().StringP (someFlag , "shorthand" , "defaultValue" , "My flag description" )
9091}
9192
9293// Parse user input (arguments and/or flags)
9394func parseInput (p * print.Printer , cmd * cobra.Command , inputArgs []string ) (* inputModel , error ) {
9495 myArg := inputArgs [0 ]
9596
96- globalFlags := globalflags .Parse (cmd )
97+ globalFlags := globalflags .Parse (p , cmd )
9798 if globalFlags .ProjectId == "" {
9899 return nil , & errors.ProjectIdError {}
99100 }
100101
101102 model := inputModel {
102103 GlobalFlagModel : globalFlags ,
103104 MyArg : myArg ,
104- MyFlag : flags .FlagToStringPointer (cmd , myFlag ),
105+ MyFlag : flags .FlagToStringPointer (p , cmd , someFlag ),
105106 }
106107
107108 // Write the input model to the debug logs
@@ -119,7 +120,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
119120
120121// Build request to the API
121122func buildRequest (ctx context.Context , model * inputModel , apiClient * foo.APIClient ) foo.ApiListInstancesRequest {
122- req := apiClient .GetBar (ctx , model .ProjectId , model .MyArg , someParam )
123+ req := apiClient .GetBar (ctx , model .ProjectId , model .MyArg , someArg )
123124 return req
124125}
125126
@@ -147,7 +148,7 @@ func outputResult(p *print.Printer, cmd *cobra.Command, outputFormat string, res
147148 resource := resources [i ]
148149 table .AddRow (* resource .ResourceId , * resource .Name , * resource .State )
149150 }
150- err := table .Display (cmd )
151+ err := table .Display (p )
151152 if err != nil {
152153 return fmt .Errorf ("render table: %w" , err )
153154 }
0 commit comments