Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update config set to uniquify slices
  • Loading branch information
henrygab committed Oct 2, 2022
commit dd854665717844fb7fb40c8c55402a409e04bf01
5 changes: 0 additions & 5 deletions cli/config/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,7 @@ func runAddCommand(cmd *cobra.Command, args []string) {
}

v := configuration.Settings.GetStringSlice(key)
// only insert values that do not already exist
// old code appended all except the first arg (which was the key)
v = append(v, args[1:]...)
// v now has the original values + the appended values
// but, the appended values might have already existed
// if so, remove them.
v = uniquifyStringSlice(v)
configuration.Settings.Set(key, v)

Expand Down
2 changes: 1 addition & 1 deletion cli/config/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func runSetCommand(cmd *cobra.Command, args []string) {
var value interface{}
switch kind {
case reflect.Slice:
value = args[1:]
value = uniquifyStringSlice(args[1:])
case reflect.String:
value = args[1]
case reflect.Bool:
Expand Down