// HelpMe receives an app and prints the help message for this app
160056
func HelpMe(app App) {
	tmplStr := appTmpl
	tmpl, err := template.New(app.Name).Parse(tmplStr)
	if err != nil {
		panic("Panic: " + err.Error())
	}

	tmpl.Execute(Output, app)

}
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)
}
926680
func SearchHelp() string {
	type help struct{ Name, Description string }
	h := []help{}
	for _, p := range keywords {
		h = append(h, help{p.Name(), p.Description()})
	}
	b, err := json.MarshalIndent(h, "", "  ")
	if err != nil {
		return "Error marshalling"
	}
	return string(b)
}
1103240
func (f *Fn) HelperName() string {
	if !f.HasStringParam() {
		return f.Name
	}
	return "_" + f.Name
}
661746
func (p *Param) HelperType() string {
	if p.Type == "string" {
		return p.fn.StrconvType()
	}
	return p.Type
}
1197600
func (m Message) Touch() (err error) {
	return m.q.TouchMessage(m.Id)
}
268965
func (c *Comandante) printDefaultHelp(w io.Writer) {
	tpl := template.New("usage")

	data := struct {
		BinaryDescription string
		BinaryName        string
		ShowHelpCommand   bool
		Commands          []*printableCommand
	}{
		c.description,
		c.binaryName,
		(c.getCommand("help") != nil),
		c.collectCommandsForHelp(),
	}

	template.Must(tpl.Parse(usage))
	_ = tpl.Execute(w, data)
}
1370973
func (m Message) IsHelpRequest() bool {
	return strings.HasSuffix(m.Message, "help") || strings.HasPrefix(m.Message, "help")
}
735549
func (i *Import) GetMessage() string {
	if i == nil || i.Message == nil {
		return ""
	}
	return *i.Message
}
1366406
func (o *Opts) Help() string {
	var err error

	//final attempt at finding the program name
	root := o
	for root.parent != nil {
		root = root.parent
	}
	if root.name == "" {
		if exe, err := osext.Executable(); err == nil {
			_, root.name = path.Split(exe)
		} else {
			root.name = "main"
		}
	}

	//add default templates
	for name, str := range DefaultTemplates {
		if _, ok := o.templates[name]; !ok {
			o.templates[name] = str
		}
	}

	//prepare templates
	t := template.New(o.name)

	t = t.Funcs(map[string]interface{}{
		//reimplementation of "template" except with dynamic name
		"templ": func(name string, data interface{}) (string, error) {
			b := &bytes.Buffer{}
			err = t.ExecuteTemplate(b, name, data)
			if err != nil {
				return "", err
			}
			return b.String(), nil
		},
	})

	//verify all templates
	for name, str := range o.templates {
		t, err = t.Parse(fmt.Sprintf(`{{define "%s"}}%s{{end}}`, name, str))
		if err != nil {
			log.Fatalf("Template error: %s: %s", name, err)
		}
	}

	//convert Opts into template data
	tf := convert(o)

	//execute all templates
	b := &bytes.Buffer{}
	err = t.ExecuteTemplate(b, "help", tf)
	if err != nil {
		log.Fatalf("Template execute: %s", err)
	}

	out := b.String()

	if o.PadAll {
		/*
			"foo
			bar"
			becomes
			"
			  foo
			  bar
			"
		*/
		lines := strings.Split(out, "\n")
		for i, l := range lines {
			lines[i] = tf.Pad + l
		}
		out = "\n" + strings.Join(lines, "\n")
	}

	out = trailingSpaces.ReplaceAllString(out, "")

	return out
}
1328602
func (q Queue) TouchMessage(msgId string) (err error) {
	return q.queues(q.Name, "messages", msgId, "touch").Req("POST", nil, nil)
}
320774
func NewApp(m Module) *Service {
	svc := loadEnv(m, GetEnvironment())
	svc.commands["help"] = &Command{
		Keyword: "help <command>",
		Run: func(ctx *CommandContext) {
			ctx.RequireExactlyNArgs(1)
			cmd := svc.commands[ctx.Args[0]]
			if cmd == nil {
				fmt.Printf("Unknown command: %s\n", ctx.Args[0])
				return
			}
			fmt.Printf("Usage of %s %s\n", os.Args[0], cmd.Keyword)
			if cmd.Usage == "" {
				fmt.Println(cmd.ShortUsage)
			} else {
				fmt.Println(cmd.Usage)
			}
		},
		ShortUsage: "Additional info for <command>",
		Usage:      "Show additional info for <command>",
	}
	return svc
}
1049089
func NewApp(name string) *App {
	app := &App{
		Name: name,
		Command: &Command{
			Action: helpAction(1),
		},
	}
	app.Command.helpTemplate = AppHelpTemplate
	app.Command.helpTemplateData = app

	app.Command.Flags.Var((*helpValue)(app.Command), "h", "print help and exit")

	return app
}
416388
func printHelp() {
	fmt.Println()
	fmt.Println("help                                                  - prints help for the bw console.")
	fmt.Println("disable memoization                                   - disables partial result memoization on query resolution.")
	fmt.Println("enable memoization                                    - enables partial result memoization of partial query results.")
	fmt.Println("export <graph_names_separated_by_commas> <file_path>  - dumps triples from graphs into a file path.")
	fmt.Println("desc <BQL>                                            - prints the execution plan for a BQL statement.")
	fmt.Println("load <file_path> <graph_names_separated_by_commas>    - load triples into the specified graphs.")
	fmt.Println("run <file_with_bql_statements>                        - runs all the BQL statements in the file.")
	fmt.Println("start tracing [trace_file]                            - starts tracing queries.")
	fmt.Println("stop tracing                                          - stops tracing queries.")
	fmt.Println("quit                                                  - quits the console.")
	fmt.Println()
}
905594
func (m *Messenger) HandleMessage(f MessageHandler) {
	m.messageHandlers = append(m.messageHandlers, f)
}
1074418
func (u *UserContext) GetMessage() string {
	if u == nil || u.Message == nil {
		return ""
	}
	return *u.Message
}
978847
func RemoveHelper(name string) {
	helpersMutex.Lock()
	defer helpersMutex.Unlock()

	delete(helpers, name)
}