// MakeCommandLineArgs make command line args
492000
func MakeCommandLineArgs(s string) []string {
	r := []string{}
	for _, part := range safeSplit(s) {
		if len(part) == 0 {
			continue
		}
		r = append(r, part)
	}
	return r
}
1356729
func (g *Generator) CommandLineParameters(parameter string) {
	g.Param = make(map[string]string)
	for _, p := range strings.Split(parameter, ",") {
		if i := strings.Index(p, "="); i < 0 {
			g.Param[p] = ""
		} else {
			g.Param[p[0:i]] = p[i+1:]
		}
	}

	g.ImportMap = make(map[string]string)
	for k, v := range g.Param {
		switch k {
		case "import_prefix":
			g.ImportPrefix = v
		case "import_path":
			g.PackageImportPath = v
		default:
			if len(k) > 0 && k[0] == 'M' {
				g.ImportMap[k[1:]] = v
			}
		}
	}
}
1037425
func WrapArguments(args ...interface{}) []reflect.Value {
	funcArgs := []reflect.Value{}

	for _, arg := range args {
		value, wrapped := arg.(reflect.Value)

		if wrapped {
			funcArgs = append(funcArgs, value)
			continue
		}

		funcArgs = append(funcArgs, reflect.ValueOf(arg))
	}

	return funcArgs
}
1268153
func ToChaincodeArgs(args ...string) [][]byte {
	bargs := make([][]byte, len(args))
	for i, arg := range args {
		bargs[i] = []byte(arg)
	}
	return bargs
}
890751
func (c *RootCmd) ProcessArgs(args []string) error {
	if len(args) == 0 {
		return nil
	}

	if len(args) == 1 {
		// Assume <clustername>
		if c.clusterName == "" {
			c.clusterName = args[0]
			return nil
		}
	}

	fmt.Printf("\nFound multiple arguments which look like a cluster name\n")
	if c.clusterName != "" {
		fmt.Printf("\t%q (via flag)\n", c.clusterName)
	}
	for _, arg := range args {
		fmt.Printf("\t%q (as argument)\n", arg)
	}
	fmt.Printf("\n")
	fmt.Printf("This often happens if you specify an argument to a boolean flag without using =\n")
	fmt.Printf("For example: use `--bastion=true` or `--bastion`, not `--bastion true`\n\n")

	if len(args) == 1 {
		return fmt.Errorf("Cannot specify cluster via --name and positional argument")
	}
	return fmt.Errorf("expected a single <clustername> to be passed as an argument")
}
47716
func buildCommand(buf []byte, args ...[]byte) []byte {
	buf = append(buf, '*')
	buf = append(buf, strconv.FormatInt(int64(len(args)), 10)...)
	buf = append(buf, '\r', '\n')
	for _, arg := range args {
		buf = append(buf, '$')
		buf = append(buf, strconv.FormatInt(int64(len(arg)), 10)...)
		buf = append(buf, '\r', '\n')
		buf = append(buf, arg...)
		buf = append(buf, '\r', '\n')
	}
	return buf
}
1288720
func (p *Plugin) PrepareCommand(extraArgs []string) (string, []string) {
	parts := strings.Split(os.ExpandEnv(p.Metadata.Command), " ")
	main := parts[0]
	baseArgs := []string{}
	if len(parts) > 1 {
		baseArgs = parts[1:]
	}
	if !p.Metadata.IgnoreFlags {
		baseArgs = append(baseArgs, extraArgs...)
	}
	return main, baseArgs
}
77181
func (cmd *CLI) Arg(index int) values.Value {
	return cmd.Args()[index]
}
876826
func (s *HadoopJarStepConfig) SetArgs(v []*string) *HadoopJarStepConfig {
	s.Args = v
	return s
}
31729
func (s *Command) SetArgs(v []*string) *Command {
	s.Args = v
	return s
}
938592
func makeCommandString(cmd string, args ...string) string {
	quotedArgs := make([]string, len(args))

	for i, arg := range args {
		if strings.ContainsAny(arg, "<#'\" \f\n\r\t\v\\") {
			arg = strconv.Quote(arg)
		}
		quotedArgs[i] = arg
	}

	return fmt.Sprintf("%s %s", cmd, strings.Join(quotedArgs, " "))
}
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
}
830710
func setCommandLineAndArgs(isWindows bool, process *specs.Process, createProcessParms *hcsshim.ProcessConfig) {
	if isWindows {
		if process.CommandLine != "" {
			createProcessParms.CommandLine = process.CommandLine
		} else {
			createProcessParms.CommandLine = system.EscapeArgs(process.Args)
		}
	} else {
		createProcessParms.CommandArgs = process.Args
	}
}
1194523
func quoteArgs(args []string) string {
	quoted := make([]string, len(args))
	for index, arg := range args {
		quoted[index] = quote(arg)
	}
	return strings.Join(quoted, " ")
}
800954
func (tcmd *TopLevelCommand) SetArgs(args []string) {
	tcmd.args = args
	tcmd.cmd.SetArgs(args)
}
857959
func PrintableCommandArgs(isQuoteFirst bool, fullCommandArgs []string) string {
	cmdArgsDecorated := []string{}
	for idx, anArg := range fullCommandArgs {
		quotedArg := strconv.Quote(anArg)
		if idx == 0 && !isQuoteFirst {
			quotedArg = anArg
		}
		cmdArgsDecorated = append(cmdArgsDecorated, quotedArg)
	}

	return strings.Join(cmdArgsDecorated, " ")
}
1263580
func (f *Finder) IDFromArgs(args []string) (string, error) {
	switch len(args) {
	case 1:
		return args[0], nil

	case 2:
		ixn, err := f.Find(args[0], args[1])
		if err != nil {
			return "", err
		}
		if ixn == nil {
			return "", fmt.Errorf(
				"Intention with source %q and destination %q not found.",
				args[0], args[1])
		}

		return ixn.ID, nil

	default:
		return "", fmt.Errorf("command requires exactly 1 or 2 arguments")
	}
}