From 40f6feb9dcc12a0c6460cd598ef7facb7bb42c96 Mon Sep 17 00:00:00 2001 From: tanhe123 Date: Wed, 22 Apr 2020 15:21:14 +0800 Subject: [PATCH 1/2] add --output parameter for publish version --- cmd/publish_version.go | 11 ++++++++++- version/version_autogen.go | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cmd/publish_version.go b/cmd/publish_version.go index 78297d8..4c14b9e 100644 --- a/cmd/publish_version.go +++ b/cmd/publish_version.go @@ -9,6 +9,8 @@ import ( "github.com/spf13/cobra" ) +var output *bool + func init() { serviceVersionDepCmd.AddCommand(publishVersionCmd) serviceVersionCmd.AddCommand(publishVersionCmd) @@ -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, "display response details") } var publishServiceVersionInput fc.PublishServiceVersionInput @@ -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) + } }, } diff --git a/version/version_autogen.go b/version/version_autogen.go index f127216..7611497 100644 --- a/version/version_autogen.go +++ b/version/version_autogen.go @@ -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 From 40dfcef310e8ed99ad690c0a6014d82381bd2521 Mon Sep 17 00:00:00 2001 From: tanhe123 Date: Wed, 22 Apr 2020 16:39:01 +0800 Subject: [PATCH 2/2] add --output parameter for publish version --- cmd/publish_version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/publish_version.go b/cmd/publish_version.go index 4c14b9e..820b5ec 100644 --- a/cmd/publish_version.go +++ b/cmd/publish_version.go @@ -25,7 +25,7 @@ func init() { "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, "display response details") + "output", false, "print raw response body of API invoke.") } var publishServiceVersionInput fc.PublishServiceVersionInput