@@ -74,7 +74,7 @@ type inputModel struct {
7474}
7575
7676// "bar" command constructor
77- func NewCmd (p * print . Printer ) *cobra .Command {
77+ func NewCmd (params * params . CmdParams ) *cobra .Command {
7878 cmd := &cobra.Command {
7979 Use: " bar" ,
8080 Short: " Short description of the command (is shown in the help of parent command)" ,
@@ -88,13 +88,13 @@ func NewCmd(p *print.Printer) *cobra.Command {
8888 ),
8989 RunE: func (cmd *cobra.Command , args []string ) error {
9090 ctx := context.Background ()
91- model , err := parseInput (p , cmd, args)
91+ model , err := parseInput (params. Printer , cmd, args)
9292 if err != nil {
9393 return err
9494 }
9595
9696 // Configure API client
97- apiClient , err := client.ConfigureClient (p , cmd)
97+ apiClient , err := client.ConfigureClient (params. Printer , cmd)
9898 if err != nil {
9999 return err
100100 }
@@ -106,17 +106,17 @@ func NewCmd(p *print.Printer) *cobra.Command {
106106 return fmt.Errorf (" (...): % w" , err)
107107 }
108108
109- projectLabel , err := projectname.GetProjectName (ctx, p , cmd)
110- if err != nil {
111- projectLabel = model.ProjectId
112- }
113-
114- // Check API response "resp" and output accordingly
115- if resp.Item == nil {
116- p .Info (" (...)" , projectLabel)
117- return nil
118- }
119- return outputResult (p , cmd, model.OutputFormat , instances)
109+ projectLabel , err := projectname.GetProjectName (ctx, params. Printer , cmd)
110+ if err != nil {
111+ projectLabel = model.ProjectId
112+ }
113+
114+ // Check API response "resp" and output accordingly
115+ if resp.Item == nil {
116+ params. Printer .Info (" (...)" , projectLabel)
117+ return nil
118+ }
119+ return outputResult (params. Printer , cmd, model.OutputFormat , instances)
120120 },
121121 }
122122
@@ -130,7 +130,7 @@ func configureFlags(cmd *cobra.Command) {
130130}
131131
132132// Parse user input (arguments and/or flags)
133- func parseInput (cmd *cobra .Command , inputArgs []string ) (*inputModel , error ) {
133+ func parseInput (p * print . Printer , cmd *cobra .Command , inputArgs []string ) (*inputModel , error ) {
134134 myArg := inputArgs[0 ]
135135
136136 globalFlags := globalflags.Parse (cmd)
@@ -140,9 +140,9 @@ func parseInput(cmd *cobra.Command, inputArgs []string) (*inputModel, error) {
140140
141141 model := inputModel{
142142 GlobalFlagModel: globalFlags,
143- MyArg myArg,
143+ MyArg: myArg,
144144 MyFlag: flags.FlagToStringPointer (cmd, myFlag),
145- }, nil
145+ }
146146
147147 // Write the input model to the debug logs
148148 if p.IsVerbosityDebug () {
0 commit comments