@@ -67,6 +67,8 @@ func NewCmd(p *print.Printer) *cobra.Command {
6767 if err != nil {
6868 p .Debug (print .ErrorLevel , "get project name: %v" , err )
6969 projectLabel = model .ProjectId
70+ } else if projectLabel == "" {
71+ projectLabel = model .ProjectId
7072 }
7173
7274 if ! model .AssumeYes {
@@ -84,7 +86,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
8486 return fmt .Errorf ("create public IP: %w" , err )
8587 }
8688
87- return outputResult (p , model , projectLabel , resp )
89+ return outputResult (p , model . OutputFormat , projectLabel , * resp )
8890 },
8991 }
9092 configureFlags (cmd )
@@ -140,8 +142,8 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APICli
140142 return req .CreatePublicIPPayload (payload )
141143}
142144
143- func outputResult (p * print.Printer , model * inputModel , projectLabel string , publicIp * iaas.PublicIp ) error {
144- switch model . OutputFormat {
145+ func outputResult (p * print.Printer , outputFormat , projectLabel string , publicIp iaas.PublicIp ) error {
146+ switch outputFormat {
145147 case print .JSONOutputFormat :
146148 details , err := json .MarshalIndent (publicIp , "" , " " )
147149 if err != nil {
0 commit comments