// LoadArgs parses args from a string in the form "K=V;K2=V2;..."
170190
func LoadArgs(args string, container interface{}) error {
	if args == "" {
		return nil
	}

	containerValue := reflect.ValueOf(container)

	pairs := strings.Split(args, ";")
	unknownArgs := []string{}
	for _, pair := range pairs {
		kv := strings.Split(pair, "=")
		if len(kv) != 2 {
			return fmt.Errorf("ARGS: invalid pair %q", pair)
		}
		keyString := kv[0]
		valueString := kv[1]
		keyField := GetKeyField(keyString, containerValue)
		if !keyField.IsValid() {
			unknownArgs = append(unknownArgs, pair)
			continue
		}
		keyFieldIface := keyField.Addr().Interface()
		u, ok := keyFieldIface.(encoding.TextUnmarshaler)
		if !ok {
			return UnmarshalableArgsError{fmt.Errorf(
				"ARGS: cannot unmarshal into field '%s' - type '%s' does not implement encoding.TextUnmarshaler",
				keyString, reflect.TypeOf(keyFieldIface))}
		}
		err := u.UnmarshalText([]byte(valueString))
		if err != nil {
			return fmt.Errorf("ARGS: error parsing value of pair %q: %v)", pair, err)
		}
	}

	isIgnoreUnknown := GetKeyField("IgnoreUnknown", containerValue).Bool()
	if len(unknownArgs) > 0 && !isIgnoreUnknown {
		return fmt.Errorf("ARGS: unknown args %q", unknownArgs)
	}
	return nil
}
1315850
func (b *BuildArgs) AddArg(key string, value *string) {
	b.allowedBuildArgs[key] = value
	b.referencedArgs[key] = struct{}{}
}
1238767
func (p *IntParam) Args() []string {
	return []string{fmt.Sprintf("--%v", p.CLIName()), p.String()}
}
894249
func simplifyArgs(args []string) (r []string) {
	r = make([]string, 0, len(args)*2)
	for i, arg := range args {
		if arg == "--" {
			for j := i; j < len(args); j++ {
				r = append(r, args[j])
			}
			break
		}
		if len(arg) > 2 && arg[0] == '-' && arg[1] != '-' {
			for j := 1; j < len(arg); j++ {
				r = append(r, "-"+string(arg[j]))
			}
		} else {
			r = append(r, arg)
		}
	}
	return
}
1069017
func validateArgs() error {
	if flag.NArg() > 0 {
		return fmt.Errorf("%s does not take parameters (did you mean -input?)", os.Args[0])
	}

	if args.bambooOut && args.xunitnetOut {
		return fmt.Errorf("-bamboo and -xunitnet are mutually exclusive")
	}

	return nil
}
1103324
func ParsePathsFromArgs() {
	flag.Parse()
	for _, dir := range flag.Args() {
		var conf loader.Config
		conf.ParserMode = parser.ParseComments
		conf.ImportWithTests(dir)
		prog, err := conf.Load()
		if err != nil {
			panic(err)
		}

		r := renamer{prog, map[*token.File]bool{}}
		r.parse()
		if !*dryRun {
			r.write()
		}
	}
}
1339053
func (c *UsergroupsEnableCall) ValidateArgs() error {
	if len(c.usergroup) <= 0 {
		return errors.New(`required field usergroup not initialized`)
	}
	return nil
}
960046
func keyValueArgsToKeys(kvs ...interface{}) []string {
	keys := []string{}
	ok := true
	for _, k := range kvs {
		if ok {
			key := string(valueToBytes(k))
			keys = append(keys, key)
		}
		ok = !ok
	}
	return keys
}
899399
func NewArg(key string, val interface{}) *Arg {
	switch val {
	case false:
		val = "0"
	case true:
		val = "1"
	}
	return &Arg{key: key, val: fmt.Sprint(val)}
}
18537
func (cmd *Cmd) Arguments(args ...string) *Cmd {
	cmd.Cmd.Args = append(cmd.Cmd.Args[0:1], args...) //we need the first argument which is the command
	return cmd
}
31729
func (s *Command) SetArgs(v []*string) *Command {
	s.Args = v
	return s
}
187834
func LoadWithParsers(config interface{}, defaultValue interface{}, args []string, customParsers map[reflect.Type]parse.Parser) error {
	cmd := &Command{
		Config:                config,
		DefaultPointersConfig: defaultValue,
	}
	_, cmd.Name = path.Split(os.Args[0])
	return LoadWithCommand(cmd, args, customParsers, nil)
}
116854
func (c *Command) Args() []*Arg {
	ret := make([]*Arg, len(c.args))
	copy(ret, c.args)

	return ret
}
678860
func (s *HadoopStepConfig) SetArgs(v []*string) *HadoopStepConfig {
	s.Args = v
	return s
}
782761
func (lp PDPKALoginPackage) PopulateArgs(h *HTTPArgs) {
	h.Add("pdpka4", S{string(lp.pdpka4)})
	h.Add("pdpka5", S{string(lp.pdpka5)})
}
1239505
func (h *syncHandler) Args() bool {
	defer h.mutex.RUnlock()
	h.mutex.RLock()
	return h.handler.Args()
}
447957
func bindArgs(names []string, arg interface{}, m *reflectx.Mapper) ([]interface{}, error) {
	arglist := make([]interface{}, 0, len(names))

	// grab the indirected value of arg
	v := reflect.ValueOf(arg)
	for v = reflect.ValueOf(arg); v.Kind() == reflect.Ptr; {
		v = v.Elem()
	}

	err := m.TraversalsByNameFunc(v.Type(), names, func(i int, t []int) error {
		if len(t) == 0 {
			return fmt.Errorf("could not find name %s in %#v", names[i], arg)
		}

		val := reflectx.FieldByIndexesReadOnly(v, t)
		arglist = append(arglist, val.Interface())

		return nil
	})

	return arglist, err
}