aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/cmd.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/cmd.go')
-rw-r--r--cmd/cmd.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmd/cmd.go b/cmd/cmd.go
index 7a4d5d0d89..5b96bcbf9a 100644
--- a/cmd/cmd.go
+++ b/cmd/cmd.go
@@ -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
+}