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

Function updateEnvironment

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

Source from the content-addressed store, hash-verified

751}
752
753func updateEnvironment(flags *pflag.FlagSet, field *[]string) {
754 toRemove := buildToRemoveSet(flags, flagEnvRemove)
755 *field = removeItems(*field, toRemove, envKey)
756
757 if flags.Changed(flagEnvAdd) {
758 envSet := map[string]string{}
759 for _, v := range *field {
760 envSet[envKey(v)] = v
761 }
762
763 value := flags.Lookup(flagEnvAdd).Value.(*opts.ListOpts)
764 for _, v := range value.GetSlice() {
765 envSet[envKey(v)] = v
766 }
767
768 *field = []string{}
769 for _, v := range envSet {
770 *field = append(*field, v)
771 }
772 }
773}
774
775func getUpdatedSecrets(ctx context.Context, apiClient client.SecretAPIClient, flags *pflag.FlagSet, secrets []*swarm.SecretReference) ([]*swarm.SecretReference, error) {
776 newSecrets := []*swarm.SecretReference{}

Calls 4

buildToRemoveSetFunction · 0.85
removeItemsFunction · 0.85
envKeyFunction · 0.85
GetSliceMethod · 0.80

Used in the wild real call sites across dependent graphs

searching dependent graphs…