1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 02:38:35 +00:00

Fix incorrect cli default values and default command (#34765)

This commit is contained in:
wxiaoguang
2025-06-18 23:25:11 +08:00
committed by GitHub
parent 416ff1fd31
commit 7954f25290
7 changed files with 76 additions and 43 deletions

View File

@@ -132,3 +132,13 @@ func PrepareConsoleLoggerLevel(defaultLevel log.Level) func(context.Context, *cl
return ctx, nil
}
}
func isValidDefaultSubCommand(cmd *cli.Command) (string, bool) {
// Dirty patch for urfave/cli's strange design.
// "./gitea bad-cmd" should not start the web server.
rootArgs := cmd.Root().Args().Slice()
if len(rootArgs) != 0 && rootArgs[0] != cmd.Name {
return rootArgs[0], false
}
return "", true
}