You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ji...@apache.org on 2019/12/11 09:23:48 UTC

[openwhisk-cli] 01/01: Add an overwrite flag to `package bind`

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

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

commit bbe59083891a2dd8850f8f514a5ed38f8c36441b
Author: jiangpengcheng <ji...@navercorp.com>
AuthorDate: Wed Dec 11 16:15:00 2019 +0800

    Add an overwrite flag to `package bind`
---
 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 25c9b96..b648916 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"))