// ReplaceArgument gets a command list; converts it to a map for easier modification, runs the provided function that
// returns a new modified map, and then converts the map back to a command string slice
518193
func ReplaceArgument(command []string, argMutateFunc func(map[string]string) map[string]string) []string {
	argMap := ParseArgumentListToMap(command)

	// Save the first command (the executable) if we're sure it's not an argument (i.e. no --)
	var newCommand []string
	if len(command) > 0 && !strings.HasPrefix(command[0], "--") {
		newCommand = append(newCommand, command[0])
	}
	newArgMap := argMutateFunc(argMap)
	newCommand = append(newCommand, BuildArgumentListFromMap(newArgMap, map[string]string{})...)
	return newCommand
}
665619
func (s *JobRun) SetArguments(v map[string]*string) *JobRun {
	s.Arguments = v
	return s
}
1241995
func (h Handler) Replace(cmd common.SetRequest) error {
	return h.handleSetCommon(cmd, common.RequestReplace)
}
420150
func (s *wfScope) replaceMap() map[string]string {
	replaceMap := make(map[string]string)
	for key, val := range s.scope {
		valStr, ok := val.(string)
		if ok {
			replaceMap[key] = valStr
		}
	}
	return replaceMap
}
1370992
func (c *ShardedClient) Replace(item *Item) MutateResponse {
	return c.mutate(
		item.Key,
		func(shardClient Client) MutateResponse {
			return shardClient.Replace(item)
		})
}
108685
func (sprite *sprite) ReplaceTexture(texture *Texture) {
	simlog.FuncIn()
	// retain reference for texture to avoid to be discarded by GC
	sprite.texture = texture
	sc := sprite.simra.spritecontainer
	sc.ReplaceTexture(&sprite.Sprite, texture.texture)
	simlog.FuncOut()
}
1132690
func (v *Value) ReplaceObjxMap(replacer func(int, Map) Map) *Value {
	arr := v.MustObjxMapSlice()
	replaced := make([](Map), len(arr))
	v.EachObjxMap(func(index int, val Map) bool {
		replaced[index] = replacer(index, val)
		return true
	})
	return &Value{data: replaced}
}
208602
func (w *wrapper) Replace(cfg Configuration) (Waiter, error) {
	w.mut.Lock()
	defer w.mut.Unlock()
	return w.replaceLocked(cfg.Copy())
}
35420
func (v replaceStrategy) MergeMap(e apply.MapElement) (apply.Result, error) {
	return v.doReplace(e)
}
1275920
func (s *Action) SetArguments(v map[string]*string) *Action {
	s.Arguments = v
	return s
}
736233
func (p *basePlan) ReplaceParent(parent, newPar Plan) error {
	for i, par := range p.parents {
		if par.GetID() == parent.GetID() {
			p.parents[i] = newPar
			return nil
		}
	}
	return SystemInternalErrorType.Gen("ReplaceParent Failed!")
}
1072102
func (d Ploop) Replace(p *ReplaceParam) error {
	args := []string{"replace"}
	if p.UUID != "" {
		args = append(args, "-u", p.UUID)
	} else if p.CurFile != "" {
		args = append(args, "-o", p.CurFile)
	} else {
		args = append(args, "-l", strconv.Itoa(p.Level))
	}

	if p.Flags != 0 {
		if p.Flags&KeepName == KeepName {
			args = append(args, "-k")
		}
	}
	args = append(args, "-i", p.File)
	args = append(args, d.dd)

	return ploop(args...)
}
911790
func ReplaceNode(target, newNode, oldNode *js.Object) {
	if newNode == oldNode {
		return
	}
	target.Call("replaceChild", newNode, oldNode)
}
1371798
func (sv *StringVisitor) AcceptArgument(v Argument) {
	addition := ""
	if v.Type != Full {
		if v.Type == Hi {
			addition = "H"
		} else {
			addition = "L"
		}
	}
	sv.result += fmt.Sprintf("arg%s%d", addition, v.Index)
}
530792
func (c *AppConfig) AddArguments(args []string) []string {
	unknown := []string{}
	for _, s := range args {
		if len(s) == 0 {
			continue
		}

		switch {
		case c.tryToAddEnvironmentArguments(s):
			c.ClassificationWinners[s] = ArgumentClassificationWinner{Name: s, Suffix: "an environment value"}
		case c.tryToAddSourceArguments(s):
			c.ClassificationWinners[s] = ArgumentClassificationWinner{Name: s, Suffix: "a source repository"}
			delete(c.EnvironmentClassificationErrors, s)
		case c.tryToAddTemplateArguments(s):
			c.ClassificationWinners[s] = ArgumentClassificationWinner{Name: s, Suffix: "a template"}
			delete(c.EnvironmentClassificationErrors, s)
			delete(c.SourceClassificationErrors, s)
		case c.tryToAddComponentArguments(s):
			// NOTE, component argument classification currently is the most lenient, so we save it for the end
			c.ClassificationWinners[s] = ArgumentClassificationWinner{Name: s, Suffix: "an image, image~source, or loaded template reference", IncludeGitErrors: true}
			delete(c.EnvironmentClassificationErrors, s)
			delete(c.TemplateClassificationErrors, s)
			// we are going to save the source errors in case this really was a source repo in the end
		default:
			klog.V(2).Infof("treating %s as unknown\n", s)
			unknown = append(unknown, s)
		}

	}
	return unknown
}
1194523
func quoteArgs(args []string) string {
	quoted := make([]string, len(args))
	for index, arg := range args {
		quoted[index] = quote(arg)
	}
	return strings.Join(quoted, " ")
}
149834
func (s *CreateDevEndpointInput) SetArguments(v map[string]*string) *CreateDevEndpointInput {
	s.Arguments = v
	return s
}