Esempio n. 1
0
// Implementation of the help command for Gondola apps
func help(ctx *app.Context) {
	var cmd string
	ctx.ParseIndexValue(0, &cmd)
	if cmd != "" {
		c := strings.ToLower(cmd)
		if _, ok := commands[c]; ok {
			fmt.Fprintf(os.Stderr, "Help for command %s:\n", c)
			commandHelp(c, -1, os.Stderr)
		} else {
			fmt.Fprintf(os.Stderr, "No such command %q\n", cmd)
		}
	} else {
		fmt.Fprintf(os.Stderr, "Commands:\n")
		commandsHelp(os.Stderr)
	}
}