MCPcopy Index your code
hub / github.com/docker/cli / updateLabels

Function updateLabels

cli/command/service/update.go:688–703  ·  view source on GitHub ↗
(flags *pflag.FlagSet, field *map[string]string)

Source from the content-addressed store, hash-verified

686}
687
688func updateLabels(flags *pflag.FlagSet, field *map[string]string) {
689 if *field != nil && flags.Changed(flagLabelRemove) {
690 toRemove := flags.Lookup(flagLabelRemove).Value.(*opts.ListOpts).GetSlice()
691 for _, label := range toRemove {
692 delete(*field, label)
693 }
694 }
695 if flags.Changed(flagLabelAdd) {
696 if *field == nil {
697 *field = map[string]string{}
698 }
699
700 values := flags.Lookup(flagLabelAdd).Value.(*opts.ListOpts).GetSlice()
701 maps.Copy((*field), opts.ConvertKVStringsToMap(values))
702 }
703}
704
705func updateSysCtls(flags *pflag.FlagSet, field *map[string]string) {
706 if *field != nil && flags.Changed(flagSysCtlRemove) {

Callers 2

updateServiceFunction · 0.85
TestUpdateLabelsFunction · 0.85

Calls 1

GetSliceMethod · 0.80

Tested by 1

TestUpdateLabelsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…