Browse Source

refactor: show command help message. (#1486)

Bo-Yi Wu 3 years ago
parent
commit
22295944df
4 changed files with 7 additions and 3 deletions
  1. 2 2
      cmd/admin.go
  2. 1 0
      cmd/dump.go
  3. 3 1
      cmd/serv.go
  4. 1 0
      cmd/web_graceful.go

+ 2 - 2
cmd/admin.go

@@ -8,10 +8,10 @@ package cmd
8 8
 import (
9 9
 	"fmt"
10 10
 
11
-	"github.com/urfave/cli"
12
-
13 11
 	"code.gitea.io/gitea/models"
14 12
 	"code.gitea.io/gitea/modules/setting"
13
+
14
+	"github.com/urfave/cli"
15 15
 )
16 16
 
17 17
 var (

+ 1 - 0
cmd/dump.go

@@ -16,6 +16,7 @@ import (
16 16
 
17 17
 	"code.gitea.io/gitea/models"
18 18
 	"code.gitea.io/gitea/modules/setting"
19
+
19 20
 	"github.com/Unknwon/cae/zip"
20 21
 	"github.com/Unknwon/com"
21 22
 	"github.com/urfave/cli"

+ 3 - 1
cmd/serv.go

@@ -17,6 +17,7 @@ import (
17 17
 	"code.gitea.io/gitea/models"
18 18
 	"code.gitea.io/gitea/modules/log"
19 19
 	"code.gitea.io/gitea/modules/setting"
20
+
20 21
 	"github.com/Unknwon/com"
21 22
 	"github.com/dgrijalva/jwt-go"
22 23
 	"github.com/urfave/cli"
@@ -105,7 +106,8 @@ func runServ(c *cli.Context) error {
105 106
 	}
106 107
 
107 108
 	if len(c.Args()) < 1 {
108
-		fail("Not enough arguments", "Not enough arguments")
109
+		cli.ShowSubcommandHelp(c)
110
+		return nil
109 111
 	}
110 112
 
111 113
 	cmd := os.Getenv("SSH_ORIGINAL_COMMAND")

+ 1 - 0
cmd/web_graceful.go

@@ -11,6 +11,7 @@ import (
11 11
 	"net/http"
12 12
 
13 13
 	"code.gitea.io/gitea/modules/log"
14
+
14 15
 	"github.com/facebookgo/grace/gracehttp"
15 16
 )
16 17