File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 20
20
)
21
21
22
22
func init () {
23
- var tagCmd = & cobra.Command {
23
+ tagCmd : = & cobra.Command {
24
24
Use : "tag <target> [<target>...]" ,
25
25
Short : "Apply a comma separated list of tags to one or more Targets." ,
26
26
Example : `
@@ -78,6 +78,8 @@ func doTag(cmd *cobra.Command, args []string) {
78
78
targetTags := tags
79
79
if tagAppend {
80
80
targetTags = Set (custom .Tags , tags )
81
+ } else if len (targetTags ) == 0 {
82
+ subcommands .DieNotNil (fmt .Errorf ("Cannot change tags from %s -> %s. Empty values are not allowed." , custom .Tags , targetTags ))
81
83
}
82
84
updates [name ] = client.UpdateTarget {
83
85
Custom : client.TufCustom {Tags : targetTags },
@@ -98,6 +100,8 @@ func doTag(cmd *cobra.Command, args []string) {
98
100
targetTags := tags
99
101
if tagAppend {
100
102
targetTags = Set (custom .Tags , tags )
103
+ } else if len (targetTags ) == 0 {
104
+ subcommands .DieNotNil (fmt .Errorf ("Cannot change tags from %s -> %s. Empty values are not allowed." , custom .Tags , targetTags ))
101
105
}
102
106
updates [name ] = client.UpdateTarget {
103
107
Custom : client.TufCustom {Tags : targetTags },
You can’t perform that action at this time.
0 commit comments