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

Function updateContainerLabels

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

Source from the content-addressed store, hash-verified

669}
670
671func updateContainerLabels(flags *pflag.FlagSet, field *map[string]string) {
672 if *field != nil && flags.Changed(flagContainerLabelRemove) {
673 toRemove := flags.Lookup(flagContainerLabelRemove).Value.(*opts.ListOpts).GetSlice()
674 for _, label := range toRemove {
675 delete(*field, label)
676 }
677 }
678 if flags.Changed(flagContainerLabelAdd) {
679 if *field == nil {
680 *field = map[string]string{}
681 }
682
683 values := flags.Lookup(flagContainerLabelAdd).Value.(*opts.ListOpts).GetSlice()
684 maps.Copy((*field), opts.ConvertKVStringsToMap(values))
685 }
686}
687
688func updateLabels(flags *pflag.FlagSet, field *map[string]string) {
689 if *field != nil && flags.Changed(flagLabelRemove) {

Callers 2

updateServiceFunction · 0.85

Calls 1

GetSliceMethod · 0.80

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…