Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #56 from aliyun/tanhehe/add_output_parameter_for_p…
Browse files Browse the repository at this point in the history
…ublish_version

add --output parameter for publish version
  • Loading branch information
tanhe123 authored Apr 22, 2020
2 parents 7ba629c + 40dfcef commit f2d9014
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion cmd/publish_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/spf13/cobra"
)

var output *bool

func init() {
serviceVersionDepCmd.AddCommand(publishVersionCmd)
serviceVersionCmd.AddCommand(publishVersionCmd)
Expand All @@ -22,6 +24,8 @@ func init() {
publishServiceVersionInput.IfMatch = publishVersionCmd.Flags().String(
"etag", "", "provide etag to do the conditional publish. "+
"If the specified etag does not match the service's, the publish will fail.")
output = publishVersionCmd.Flags().Bool(
"output", false, "print raw response body of API invoke.")
}

var publishServiceVersionInput fc.PublishServiceVersionInput
Expand All @@ -43,9 +47,14 @@ fcli service version publish -s(--service-name) service_name
fmt.Printf("Error: can not create fc client: %s\n", err)
return
}
_, err = client.PublishServiceVersion(&publishServiceVersionInput)

resp, err := client.PublishServiceVersion(&publishServiceVersionInput)
if err != nil {
fmt.Printf("Error: %s\n", err)
}

if *output {
fmt.Println(resp)
}
},
}
2 changes: 1 addition & 1 deletion version/version_autogen.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package version
// Default build-time variable for library-import.
// This file is overridden on build with build-time informations.
const (
Version string = "1.0.0"
Version string = "1.0.3"
)

// AUTOGENERATED FILE; see hack/.go-autogen

0 comments on commit f2d9014

Please sign in to comment.