Skip to content

Commit 3529787

Browse files
Add an overwrite flag to "package bind" (apache#474)
1 parent c5daef0 commit 3529787

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

commands/flags.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ type FlagsStruct struct {
6767
detail bool
6868
format string
6969
nameSort bool // sorts list alphabetically by entity name
70+
overwrite bool
7071
}
7172

7273
property struct {

commands/package.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ var packageBindCmd = &cobra.Command{
103103
Binding: binding,
104104
}
105105

106-
_, _, err = Client.Packages.Insert(p, false)
106+
overwrite := Flags.common.overwrite
107+
108+
_, _, err = Client.Packages.Insert(p, overwrite)
107109
if err != nil {
108110
whisk.Debug(whisk.DbgError, "Client.Packages.Insert(%#v, false) failed: %s\n", p, err)
109111
errStr := wski18n.T("Binding creation failed: {{.err}}", map[string]interface{}{"err": err})
@@ -522,6 +524,7 @@ func init() {
522524
packageBindCmd.Flags().StringVarP(&Flags.common.annotFile, "annotation-file", "A", "", wski18n.T("`FILE` containing annotation values in JSON format"))
523525
packageBindCmd.Flags().StringSliceVarP(&Flags.common.param, "param", "p", []string{}, wski18n.T("parameter values in `KEY VALUE` format"))
524526
packageBindCmd.Flags().StringVarP(&Flags.common.paramFile, "param-file", "P", "", wski18n.T("`FILE` containing parameter values in JSON format"))
527+
packageBindCmd.Flags().BoolVarP(&Flags.common.overwrite, "overwrite", "o", false, wski18n.T("overwrite bind"))
525528

526529
packageListCmd.Flags().IntVarP(&Flags.common.skip, "skip", "s", 0, wski18n.T("exclude the first `SKIP` number of packages from the result"))
527530
packageListCmd.Flags().IntVarP(&Flags.common.limit, "limit", "l", 30, wski18n.T("only return `LIMIT` number of packages from the collection"))

0 commit comments

Comments
 (0)