Skip to content

Commit dfd47ce

Browse files
committed
fix
1 parent 70deea2 commit dfd47ce

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

cmd/admin_auth_smtp.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package cmd
66
import (
77
"context"
88
"errors"
9-
"fmt"
109
"strings"
1110

1211
auth_model "code.gitea.io/gitea/models/auth"
@@ -145,7 +144,6 @@ func (a *authService) runAddSMTP(ctx context.Context, c *cli.Command) error {
145144
}
146145
active := true
147146
if c.IsSet("active") {
148-
fmt.Println("Active is set!", c.Bool("active"))
149147
active = c.Bool("active")
150148
}
151149

cmd/main.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ func appGlobalFlags() []cli.Flag {
7575
}
7676
}
7777

78-
func prepareSubcommandWithConfig(command *cli.Command, globalFlags []cli.Flag) {
79-
command.Flags = append(append([]cli.Flag{}, globalFlags...), command.Flags...)
78+
func prepareSubcommandWithGlobalFlags(command *cli.Command) {
79+
command.Flags = append(append([]cli.Flag{}, appGlobalFlags()...), command.Flags...)
8080
command.Action = prepareWorkPathAndCustomConf(command.Action)
8181
command.HideHelp = true
8282
if command.Name != "help" {
8383
command.Commands = append(command.Commands, cmdHelp())
8484
}
8585
for i := range command.Commands {
86-
prepareSubcommandWithConfig(command.Commands[i], globalFlags)
86+
prepareSubcommandWithGlobalFlags(command.Commands[i])
8787
}
8888
}
8989

@@ -157,13 +157,12 @@ func NewMainApp(appVer AppVersion) *cli.Command {
157157

158158
app.DefaultCommand = CmdWeb.Name
159159

160-
globalFlags := appGlobalFlags()
161160
app.Flags = append(app.Flags, cli.VersionFlag)
162-
app.Flags = append(app.Flags, globalFlags...)
161+
app.Flags = append(app.Flags, appGlobalFlags()...)
163162
app.HideHelp = true // use our own help action to show helps (with more information like default config)
164163
app.Before = PrepareConsoleLoggerLevel(log.INFO)
165164
for i := range subCmdWithConfig {
166-
prepareSubcommandWithConfig(subCmdWithConfig[i], globalFlags)
165+
prepareSubcommandWithGlobalFlags(subCmdWithConfig[i])
167166
}
168167
app.Commands = append(app.Commands, subCmdWithConfig...)
169168
app.Commands = append(app.Commands, subCmdStandalone...)

cmd/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func makePathOutput(workPath, customPath, customConf string) string {
3131
func newTestApp(testCmdAction cli.ActionFunc) *cli.Command {
3232
app := NewMainApp(AppVersion{})
3333
testCmd := &cli.Command{Name: "test-cmd", Action: testCmdAction}
34-
prepareSubcommandWithConfig(testCmd, appGlobalFlags())
34+
prepareSubcommandWithGlobalFlags(testCmd, appGlobalFlags())
3535
app.Commands = append(app.Commands, testCmd)
3636
app.DefaultCommand = testCmd.Name
3737
return app

0 commit comments

Comments
 (0)