// MakeHelp generates a help string based on the capabilities of the Command
4344
func MakeHelp(c AutoHelp) string {
	usageText := c.Usage()

	// If the length of Usage() is zero, then assume this is a hidden
	// command.
	if len(usageText) == 0 {
		return ""
	}

	descriptionText := wordwrap.WrapString(c.Description(), 60)
	descrLines := strings.Split(descriptionText, "\n")
	prefixedLines := make([]string, len(descrLines))
	for i := range descrLines {
		prefixedLines[i] = "  " + descrLines[i]
	}
	descriptionText = strings.Join(prefixedLines, "\n")

	c.InitOpts()
	flags := []*flag.Flag{}
	c.VisitAllFlags(func(f *flag.Flag) {
		flags = append(flags, f)
	})
	optionsText := OptionsHelpOutput(flags)

	var helpOutput string
	switch {
	case len(optionsText) == 0 && len(descriptionText) == 0:
		helpOutput = usageText
	case len(optionsText) == 0:
		helpOutput = fmt.Sprintf(`Usage: %s

%s`,
			usageText, descriptionText)
	case len(descriptionText) == 0 && len(optionsText) > 0:
		helpOutput = fmt.Sprintf(`Usage: %s

Options:

%s`,
			usageText, optionsText)
	default:
		helpOutput = fmt.Sprintf(`Usage: %s

%s

Options:

%s`,
			usageText, descriptionText, optionsText)
	}

	return strings.TrimSpace(helpOutput)
}
1032750
func (kf *KunstructuredFactoryImpl) MakeConfigMap(args *types.ConfigMapArgs, options *types.GeneratorOptions) (ifc.Kunstructured, error) {
	cm, err := kf.cmFactory.MakeConfigMap(args, options)
	if err != nil {
		return nil, err
	}
	return NewKunstructuredFromObject(cm)
}
653081
func cmdHelp(session *sp.Session, args []string, abort <-chan bool) error {
	println("use <command> -h for more information")
	for command := range commands {
		println(" - ", command)
	}
	return nil
}
1104808
func helpFunc(commands map[string]cli.CommandFactory) string {
	// Determine the maximum key length, and classify based on type
	porcelain := make(map[string]cli.CommandFactory)
	plumbing := make(map[string]cli.CommandFactory)
	maxKeyLen := 0
	for key, f := range commands {
		if len(key) > maxKeyLen {
			maxKeyLen = len(key)
		}

		if _, ok := PlumbingCommands[key]; ok {
			plumbing[key] = f
		} else {
			porcelain[key] = f
		}
	}

	// The output produced by this is included in the docs at
	// website/source/docs/commands/index.html.markdown; if you
	// change this then consider updating that to match.
	helpText := fmt.Sprintf(`
Usage: terraform [-version] [-help] <command> [args]

The available commands for execution are listed below.
The most common, useful commands are shown first, followed by
less common or more advanced commands. If you're just getting
started with Terraform, stick with the common commands. For the
other commands, please read the help and docs before usage.

Common commands:
%s
All other commands:
%s
`, listCommands(porcelain, maxKeyLen), listCommands(plumbing, maxKeyLen))

	return strings.TrimSpace(helpText)
}
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, " "))
}
114283
func (f *Flags) PrintHelp() {
	fmt.Fprintf(f.writer, "Usage of %s:\n", f.appName)
	fmt.Fprintf(f.writer, "%s\n", helpMessage)
	fmt.Fprintf(f.writer, "FLAGS\n")
	f.flagSet.PrintDefaults()
}
323886
func (c *CLI) helpCommands(prefix string) map[string]CommandFactory {
	// If our prefix isn't empty, make sure it ends in ' '
	if prefix != "" && prefix[len(prefix)-1] != ' ' {
		prefix += " "
	}

	// Get all the subkeys of this command
	var keys []string
	c.commandTree.WalkPrefix(prefix, func(k string, raw interface{}) bool {
		// Ignore any sub-sub keys, i.e. "foo bar baz" when we want "foo bar"
		if !strings.Contains(k[len(prefix):], " ") {
			keys = append(keys, k)
		}

		return false
	})

	// For each of the keys return that in the map
	result := make(map[string]CommandFactory, len(keys))
	for _, k := range keys {
		raw, ok := c.commandTree.Get(k)
		if !ok {
			// We just got it via WalkPrefix above, so we just panic
			panic("not found: " + k)
		}

		// If this is a hidden command, don't show it
		if _, ok := c.commandHidden[k]; ok {
			continue
		}

		result[k] = raw.(CommandFactory)
	}

	return result
}
231874
func flagHelp(field reflect.StructField) (flaghelp string) {
	if flaghelp, ok := field.Tag.Lookup("help"); ok {
		return flaghelp
	}
	return ""
}
354066
func (cm AsStandard) MSearchHelp(resource string) *metadata.MSearchHelp {
	msh := metadata.MSearchHelp{}
	mi := metadata.MISearchHelp
	for _, cd := range cm.Elements[mi.Name] {
		if cd.Attr["Resource"] != resource {
			continue
		}
		metadata.FieldTransfer(cd.Attr).To(&msh)
		for _, entry := range cd.Entries() {
			tmp := metadata.SearchHelp{}
			entry.SetFields(&tmp)
			msh.SearchHelp = append(msh.SearchHelp, tmp)
		}
	}
	return &msh
}
1301158
func PrintHelp(flagMap map[string]reflect.StructField, defaultValmap map[string]reflect.Value, parsers map[reflect.Type]parse.Parser) error {
	return PrintHelpWithCommand(flagMap, defaultValmap, parsers, nil, nil)
}
1094336
func makeCmdLine(args []string) string {
	var s string
	for _, v := range args {
		if s != "" {
			s += " "
		}
		s += syscall.EscapeArg(v)
	}
	return s
}
1237448
func outputHelper(info, namespace string, singleNamespace bool) string {
	if singleNamespace {
		return info
	}
	return fmt.Sprintf("<%s %s>", namespace, info)
}
1096214
func (ld Loader) PrintHelp(cfg interface{}) {
	w := bufio.NewWriter(os.Stderr)
	ld.fprintHelp(w, cfg, stderr())
	w.Flush()
}
538627
func makeParams(action string) map[string]string {
	params := make(map[string]string)
	params[ActionKey] = action
	return params
}
943783
func makeSymlinks(targetName string, commandFns []func() *cobra.Command) error {
	wd, err := os.Getwd()
	if err != nil {
		return err
	}

	var errs bool
	for _, commandFn := range commandFns {
		command := commandFn()
		link := path.Join(wd, command.Name())

		err := os.Symlink(targetName, link)
		if err != nil {
			errs = true
			fmt.Println(err)
		}
	}

	if errs {
		return errors.New("Error creating one or more symlinks")
	}
	return nil
}
768726
func MakeDirs(path string) error {
	if err := os.MkdirAll(path, 0755); err != nil {
		return errors.Annotate(err, "").Err()
	}
	return nil
}
101489
func (e *errorWrapper) Make(request *http.Request, passedResponse *Response) error {
	err := e.connection.Make(request, passedResponse)

	if rawHTTPStatusErr, ok := err.(RawHTTPStatusError); ok {
		return convert(rawHTTPStatusErr)
	}

	return err
}