Skip to content

Commit b2d5244

Browse files
committed
fix
1 parent 9441550 commit b2d5244

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

cmd/main.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ func cmdHelp() *cli.Command {
2929
if c.Name == "help" {
3030
targetCmdIdx = 1
3131
}
32-
if lineage[targetCmdIdx].Name != "Gitea" {
33-
err = cli.ShowCommandHelp(ctx, lineage[targetCmdIdx], lineage[targetCmdIdx].Name)
32+
if lineage[targetCmdIdx] != lineage[targetCmdIdx].Root() {
33+
err = cli.ShowCommandHelp(ctx, lineage[targetCmdIdx+1] /* parent cmd */, lineage[targetCmdIdx].Name /* sub cmd */)
3434
} else {
3535
err = cli.ShowAppHelp(c)
3636
}
@@ -119,14 +119,12 @@ type AppVersion struct {
119119
}
120120

121121
func NewMainApp(appVer AppVersion) *cli.Command {
122-
app := &cli.Command{
123-
Name: "Gitea",
124-
// HelpName: "gitea",
125-
Usage: "A painless self-hosted Git service",
126-
Description: `Gitea program contains "web" and other subcommands. If no subcommand is given, it starts the web server by default. Use "web" subcommand for more web server arguments, use other subcommands for other purposes.`,
127-
Version: appVer.Version + appVer.Extra,
128-
EnableShellCompletion: true,
129-
}
122+
app := &cli.Command{}
123+
app.Name = "gitea" // must be lower-cased because it appears in the "USAGE" section like "gitea doctor [command [command options]]"
124+
app.Usage = "A painless self-hosted Git service"
125+
app.Description = `Gitea program contains "web" and other subcommands. If no subcommand is given, it starts the web server by default. Use "web" subcommand for more web server arguments, use other subcommands for other purposes.`
126+
app.Version = appVer.Version + appVer.Extra
127+
app.EnableShellCompletion = true
130128

131129
// these sub-commands need to use config file
132130
subCmdWithConfig := []*cli.Command{

0 commit comments

Comments
 (0)