commands/create.go
func flagHackLookup(flagName string) string {
	// e.g. "-d" for "--driver"
	flagPrefix := flagName[1:3]

	// TODO: Should we support -flag-name (single hyphen) syntax as well?
	for i, arg := range os.Args {
		if strings.Contains(arg, flagPrefix) {
			// format '--driver foo' or '-d foo'
			if arg == flagPrefix || arg == flagName {
				if i+1 < len(os.Args) {
					return os.Args[i+1]
				}
			}

			// format '--driver=foo' or '-d=foo'
			if strings.HasPrefix(arg, flagPrefix+"=") || strings.HasPrefix(arg, flagName+"=") {
				return strings.Split(arg, "=")[1]
			}
		}
	}

	return ""
}
func flagHackLookup(flagName string) string {
	// e.g. "-d" for "--driver"
	flagPrefix := flagName[1:3]

	// TODO: Should we support -flag-name (single hyphen) syntax as well?
	for i, arg := range os.Args {
		if strings.Contains(arg, flagPrefix) {
			// format '--driver foo' or '-d foo'
			if arg == flagPrefix || arg == flagName {
				if i+1 < len(os.Args) {
					return os.Args[i+1]
				}
			}

			// format '--driver=foo' or '-d=foo'
			if strings.HasPrefix(arg, flagPrefix+"=") || strings.HasPrefix(arg, flagName+"=") {
				return strings.Split(arg, "=")[1]
			}
		}
	}

	return ""
}
func flagHackLookup ( flagName string ) string { // e.g. "-d" for "--driver" flagPrefix := flagName [ 1 : 3 ] // TODO: Should we support -flag-name (single hyphen) syntax as well? for i , arg := range os . Args { if strings . Contains ( arg , flagPrefix ) { // format '--driver foo' or '-d foo' if arg == flagPrefix || arg == flagName { if i + 1 < len ( os . Args ) { return os . Args [ i + 1 ] } } // format '--driver=foo' or '-d=foo' if strings . HasPrefix ( arg , flagPrefix + " " ) || strings . HasPrefix ( arg , flagName + " " ) { return strings . Split ( arg , " " ) [ 1 ] } } } return " " }
// The following function is needed because the CLI acrobatics that we're doing
// (with having an "outer" and "inner" function each with their own custom
// settings and flag parsing needs) are not well supported by codegangsta/cli.
//
// Instead of trying to make a convoluted series of flag parsing and relying on
// codegangsta/cli internals work well, we simply read the flags we're
// interested in from the outer function into module-level variables, and then
// use them from the "inner" function.
//
// I'm not very pleased about this, but it seems to be the only decent
// compromise without drastically modifying codegangsta/cli internals or our
// own CLI.
The following function is needed because the CLI acrobatics that we re doing ( with having an outer and inner function each with their own custom settings and flag parsing needs ) are not well supported by codegangsta / cli . Instead of trying to make a convoluted series of flag parsing and relying on codegangsta / cli internals work well we simply read the flags we re interested in from the outer function into module - level variables and then use them from the inner function . I m not very pleased about this but it seems to be the only decent compromise without drastically modifying codegangsta / cli internals or our own CLI .