// ParseArgv gets the required path.
513759
func (c *CmdSimpleFSSyncEnable) ParseArgv(ctx *cli.Context) error {
	if len(ctx.Args()) != 1 {
		return fmt.Errorf("wrong number of arguments")
	}

	p, err := makeSimpleFSPath(ctx.Args()[0])
	if err != nil {
		return err
	}
	c.path = p
	return nil
}
452279
func (c *CmdSimpleFSPs) ParseArgv(ctx *cli.Context) error {

	c.recurse = ctx.Bool("recurse")

	return nil
}
841326
func parseArgs(argv []string) (string, []string) {
	if len(argv) == 1 {
		if argv[0] == "--help" || argv[0] == "-h" {
			// rearrange "deis --help" as "deis help"
			argv[0] = "help"
		} else if argv[0] == "--version" || argv[0] == "-v" {
			// rearrange "deis --version" as "deis version"
			argv[0] = "version"
		}
	}

	if len(argv) >= 2 {
		// Rearrange "deis help <command>" to "deis <command> --help".
		if argv[0] == "help" || argv[0] == "--help" || argv[0] == "-h" {
			argv = append(argv[1:], "--help")
		}
	}

	if len(argv) > 0 {
		argv[0] = replaceShortcut(argv[0])

		index := strings.Index(argv[0], ":")

		if index != -1 {
			command := argv[0]
			return command[:index], argv
		}

		return argv[0], argv
	}

	return "", argv
}
1184736
func (c *CmdGitMddel) ParseArgv(ctx *cli.Context) error {
	if len(ctx.Args()) != 2 {
		return fmt.Errorf("mddel takes two arguments")
	}
	c.folder = ctx.Args()[0]
	c.repoName = ctx.Args()[1]
	return nil
}
620437
func (c *Conn) ParseDefaultConfigEnv() error {
	ret := C.rados_conf_parse_env(c.cluster, nil)
	if ret == 0 {
		return nil
	} else {
		return RadosError(int(ret))
	}
}
226435
func parseArgument(arg string) (string, string, error) {
	if !strings.HasPrefix(arg, "--") {
		return "", "", errors.New("the argument should start with '--'")
	}
	if !strings.Contains(arg, "=") {
		return "", "", errors.New("the argument should have a '=' between the flag and the value")
	}
	// Remove the starting --
	arg = strings.TrimPrefix(arg, "--")
	// Split the string on =. Return only two substrings, since we want only key/value, but the value can include '=' as well
	keyvalSlice := strings.SplitN(arg, "=", 2)

	// Make sure both a key and value is present
	if len(keyvalSlice) != 2 {
		return "", "", errors.New("the argument must have both a key and a value")
	}
	if len(keyvalSlice[0]) == 0 {
		return "", "", errors.New("the argument must have a key")
	}

	return keyvalSlice[0], keyvalSlice[1], nil
}
741655
func RemoteParserPath(parserName string) string {
	return filepath.Join(runtime.GOOS, runtime.GOARCH, parserName+archExt)
}
539461
func FullGoSearchPath() string {
	allPaths := os.Getenv(GOPATHKey)
	if allPaths == "" {
		allPaths = filepath.Join(os.Getenv("HOME"), "go")
	}
	if allPaths != "" {
		allPaths = strings.Join([]string{allPaths, runtime.GOROOT()}, ":")
	} else {
		allPaths = runtime.GOROOT()
	}
	return allPaths
}
388821
func (ctx *Context) RootArgv() interface{} {
	if isEmptyArgvList(ctx.argvList) {
		return nil
	}
	index := len(ctx.argvList) - 1
	return ctx.argvList[index]
}
1238762
func GetPkgRelativePath(path string) (string, error) {
	abspath, err := filepath.Abs(path)
	if err != nil {
		abspath = path
	}
	if strings.HasSuffix(abspath, ".go") {
		abspath = filepath.Dir(abspath)
	}
	for _, base := range Gopath() {
		projectRoot := filepath.FromSlash(fmt.Sprintf("%s/src/", base))
		if strings.HasPrefix(abspath, projectRoot) {
			return strings.TrimPrefix(abspath, projectRoot), nil
		}
	}
	return "", errors.New("no project relative path found")
}
970720
func (c *CmdSimpleFSCopy) ParseArgv(ctx *cli.Context) error {
	var err error

	c.recurse = ctx.Bool("recursive")
	c.interactive = ctx.Bool("interactive")
	c.force = ctx.Bool("force")

	if c.force && c.interactive {
		return errors.New("force and interactive are incompatible")
	}

	c.src, c.dest, err = parseSrcDestArgs(c.G(), ctx, "cp")

	return err
}
78630
func parseEnv(env string) (string, string, error) {
	parts := strings.SplitN(env, "=", 2)
	if len(parts) != 2 {
		return "", "", fmt.Errorf("environment variable must contain '=': %s", env)
	}

	name, value := parts[0], parts[1]
	if name == "" {
		return "", "", fmt.Errorf("environment variable must have non-empty name: %s", env)
	}
	return name, value, nil
}
1223639
func ctlParseArgv(ctx *cli.Context) map[string]bool {
	components := defaultCtlComponents(true)
	if ctx.String("exclude") != "" {
		excluded := strings.Split(ctx.String("exclude"), ",")
		for _, exclude := range excluded {
			components[exclude] = false
		}
	}
	if ctx.String("include") != "" {
		included := strings.Split(ctx.String("include"), ",")
		components = defaultCtlComponents(false)
		for _, include := range included {
			components[include] = true
		}
	}
	return components
}
1127200
func parseArgs(args []string, flagMap map[string]reflect.StructField, parsers map[reflect.Type]parse.Parser) (map[string]parse.Parser, error) {
	newParsers := map[string]parse.Parser{}
	flagSet := flag.NewFlagSet("flaeg.Load", flag.ContinueOnError)

	// Disable output
	flagSet.SetOutput(ioutil.Discard)

	var err error
	for flg, structField := range flagMap {
		if parser, ok := parsers[structField.Type]; ok {
			newParserValue := reflect.New(reflect.TypeOf(parser).Elem())
			newParserValue.Elem().Set(reflect.ValueOf(parser).Elem())
			newParser := newParserValue.Interface().(parse.Parser)

			if short := structField.Tag.Get("short"); len(short) == 1 {
				flagSet.VarP(newParser, flg, short, structField.Tag.Get("description"))
			} else {
				flagSet.Var(newParser, flg, structField.Tag.Get("description"))
			}
			newParsers[flg] = newParser
		} else {
			err = ErrParserNotFound
		}
	}

	// prevents case sensitivity issue
	args = argsToLower(args)
	if errParse := flagSet.Parse(args); errParse != nil {
		return nil, errParse
	}

	// Visitor in flag.Parse
	var flagList []*flag.Flag
	visitor := func(fl *flag.Flag) {
		flagList = append(flagList, fl)
	}

	// Fill flagList with parsed flags
	flagSet.Visit(visitor)

	// Return var
	valMap := make(map[string]parse.Parser)

	// Return parsers on parsed flag
	for _, flg := range flagList {
		valMap[flg.Name] = newParsers[flg.Name]
	}

	return valMap, err
}
600494
func ParseFullDockerRegistryURL(s string) (*DockerRegistryURL, error) {
	s = handleSchemelessQuayRegistries(s)

	registryURL := &DockerRegistryURL{
		Scheme: "https",
	}

	u, err := url.Parse(s)
	if err != nil {
		return nil, err
	}

	if u.Scheme == "" || u.Host == "" {
		return registryURL, fmt.Errorf("Registry URL must provide a scheme and host: %q", s)
	}

	registryURL.Scheme = u.Scheme
	registryURL.Userinfo = u.User

	host, port, err := splitHostPort(u.Host)
	if err != nil {
		return nil, err
	}
	registryURL.Host = host
	registryURL.Port = port

	// Parse everything after <scheme>://<host>:<port>
	err = registryURL.parsePath(u.Path)
	if err != nil {
		return nil, err
	}
	return registryURL, nil
}
507625
func ParseFlagsWithArgs(cmd string) []string {
	flag.Parse()

	if *Version {
		AppVersion.Print()
		os.Exit(0)
	}

	args := flag.Args()
	if len(args) == 0 {
		log.Exitf("%s expected at least one positional argument", cmd)
	}

	return args
}
267935
func NewSearchArg(Path string, Query string) *SearchArg {
	s := new(SearchArg)
	s.Path = Path
	s.Query = Query
	s.Start = 0
	s.MaxResults = 100
	s.Mode = &SearchMode{Tagged: dropbox.Tagged{"filename"}}
	return s
}