@@ -68,6 +68,9 @@ func NewCmd(p *print.Printer) *cobra.Command {
6868 p .Debug (print .ErrorLevel , "get project name: %v" , err )
6969 projectLabel = model .ProjectId
7070 }
71+ if projectLabel == "" {
72+ projectLabel = model .ProjectId
73+ }
7174
7275 if ! model .AssumeYes {
7376 prompt := fmt .Sprintf ("Are you sure you want to create a public IP for project %q?" , projectLabel )
@@ -84,7 +87,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
8487 return fmt .Errorf ("create public IP: %w" , err )
8588 }
8689
87- return outputResult (p , model , projectLabel , resp )
90+ return outputResult (p , model . OutputFormat , projectLabel , * resp )
8891 },
8992 }
9093 configureFlags (cmd )
@@ -140,8 +143,8 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APICli
140143 return req .CreatePublicIPPayload (payload )
141144}
142145
143- func outputResult (p * print.Printer , model * inputModel , projectLabel string , publicIp * iaas.PublicIp ) error {
144- switch model . OutputFormat {
146+ func outputResult (p * print.Printer , outputFormat , projectLabel string , publicIp iaas.PublicIp ) error {
147+ switch outputFormat {
145148 case print .JSONOutputFormat :
146149 details , err := json .MarshalIndent (publicIp , "" , " " )
147150 if err != nil {
0 commit comments