Esempio n. 1
0
File: hg.go Progetto: hgoo/hg
func help(args []string) {
	if len(args) == 0 {
		usage()
		return
	}
	if len(args) != 1 {
		fmt.Fprintf(os.Stdout, "usage: hg help command\n\nToo many arguments given.\n")
		os.Exit(0)
	}

	arg := args[0]

	for _, cmd := range commands {
		if cmd.Name() == arg {
			utils.Tmpl(os.Stdout, template.HelpTemplate, cmd)
			return
		}
	}

	fmt.Fprintf(os.Stdout, "Unknown help topic %#q.  Run 'hg help'.\n", arg)
	os.Exit(0)
}
Esempio n. 2
0
File: hg.go Progetto: hgoo/hg
func usage() {
	utils.Tmpl(os.Stdout, template.UsageTemplate, commands)
	os.Exit(0)
}