You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by st...@apache.org on 2020/05/04 04:20:53 UTC

[openwhisk-cli] branch master updated: Add an overwrite flag to "package bind" (#474)

This is an automated email from the ASF dual-hosted git repository.

style95 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-cli.git


The following commit(s) were added to refs/heads/master by this push:
     new 3529787  Add an overwrite flag to "package bind" (#474)
3529787 is described below

commit 352978782dd62ddca80cc4b3a757150cc10bb94f
Author: jiangpch <ji...@navercorp.com>
AuthorDate: Mon May 4 12:20:46 2020 +0800

    Add an overwrite flag to "package bind" (#474)
---
 commands/flags.go   | 1 +
 commands/package.go | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/commands/flags.go b/commands/flags.go
index b48058c..a4f5e05 100644
--- a/commands/flags.go
+++ b/commands/flags.go
@@ -67,6 +67,7 @@ type FlagsStruct struct {
 		detail     bool
 		format     string
 		nameSort   bool // sorts list alphabetically by entity name
+		overwrite  bool
 	}
 
 	property struct {
diff --git a/commands/package.go b/commands/package.go
index 1bb69e2..188b7f5 100644
--- a/commands/package.go
+++ b/commands/package.go
@@ -103,7 +103,9 @@ var packageBindCmd = &cobra.Command{
 			Binding:     binding,
 		}
 
-		_, _, err = Client.Packages.Insert(p, false)
+		overwrite := Flags.common.overwrite
+
+		_, _, err = Client.Packages.Insert(p, overwrite)
 		if err != nil {
 			whisk.Debug(whisk.DbgError, "Client.Packages.Insert(%#v, false) failed: %s\n", p, err)
 			errStr := wski18n.T("Binding creation failed: {{.err}}", map[string]interface{}{"err": err})
@@ -522,6 +524,7 @@ func init() {
 	packageBindCmd.Flags().StringVarP(&Flags.common.annotFile, "annotation-file", "A", "", wski18n.T("`FILE` containing annotation values in JSON format"))
 	packageBindCmd.Flags().StringSliceVarP(&Flags.common.param, "param", "p", []string{}, wski18n.T("parameter values in `KEY VALUE` format"))
 	packageBindCmd.Flags().StringVarP(&Flags.common.paramFile, "param-file", "P", "", wski18n.T("`FILE` containing parameter values in JSON format"))
+	packageBindCmd.Flags().BoolVarP(&Flags.common.overwrite, "overwrite", "o", false, wski18n.T("overwrite bind"))
 
 	packageListCmd.Flags().IntVarP(&Flags.common.skip, "skip", "s", 0, wski18n.T("exclude the first `SKIP` number of packages from the result"))
 	packageListCmd.Flags().IntVarP(&Flags.common.limit, "limit", "l", 30, wski18n.T("only return `LIMIT` number of packages from the collection"))