github.com/klaytn/klaytn@v1.12.1/cmd/utils/helptemplate.go (about) 1 // Copyright 2019 The klaytn Authors 2 // This file is part of the klaytn library. 3 // 4 // The klaytn library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The klaytn library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the klaytn library. If not, see <http://www.gnu.org/licenses/>. 16 17 package utils 18 19 // GlobalAppHelpTemplate is the test template for the default, global app help topic. 20 var ( 21 GlobalAppHelpTemplate = `NAME: 22 {{.App.Name}} - {{.App.Usage}} 23 24 USAGE: 25 {{.App.HelpName}} [options]{{if .App.Commands}} command [command options]{{end}} {{if .App.ArgsUsage}}{{.App.ArgsUsage}}{{else}}[arguments...]{{end}} 26 {{if .App.Version}} 27 VERSION: 28 {{.App.Version}} 29 {{end}}{{if len .App.Authors}} 30 AUTHOR(S): 31 {{range .App.Authors}}{{ . }}{{end}} 32 {{end}}{{if .App.Commands}} 33 COMMANDS: 34 {{range .App.Commands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}} 35 {{end}}{{end}}{{if .FlagGroups}} 36 {{range .FlagGroups}}{{.Name}} OPTIONS: 37 {{range .Flags}}{{.}} 38 {{end}} 39 {{end}}{{end}}{{if .App.Copyright }} 40 COPYRIGHT: 41 {{.App.Copyright}} 42 {{end}} 43 ` 44 CommandHelpTemplate = `{{.cmd.Name}}{{if .cmd.Subcommands}} command{{end}}{{if .cmd.Flags}} [command options]{{end}} [arguments...] 45 {{if .cmd.Description}}{{.cmd.Description}} 46 {{end}}{{if .cmd.Subcommands}} 47 SUBCOMMANDS: 48 {{range .cmd.Subcommands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}} 49 {{end}}{{end}}{{if .categorizedFlags}} 50 {{range $idx, $categorized := .categorizedFlags}}{{$categorized.Name}} OPTIONS: 51 {{range $categorized.Flags}}{{"\t"}}{{.}} 52 {{end}} 53 {{end}}{{end}}` 54 55 AppHelpTemplate = `{{.Name}} {{if .Flags}}[global options] {{end}}command{{if .Flags}} [command options]{{end}} [arguments...] 56 57 VERSION: 58 {{.Version}} 59 60 COMMANDS: 61 {{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}} 62 {{end}}{{if .Flags}} 63 GLOBAL OPTIONS: 64 {{range .Flags}}{{.}} 65 {{end}}{{end}} 66 ` 67 KgenHelpTemplate = `NAME: 68 {{.Name}} - {{.Usage}} 69 70 USAGE: 71 {{.HelpName}} [options...]{{if .Commands}} [command]{{end}} 72 {{if .Commands}} 73 COMMANDS: 74 {{range .Commands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}} 75 {{end}}{{end}}{{if .Flags}} 76 OPTIONS: 77 {{range .Flags}}{{.}} 78 {{end}}{{end}}{{if .Copyright }} 79 COPYRIGHT: 80 {{.Copyright}}{{end}} 81 ` 82 )