Skip to content

Commit 3fc0346

Browse files
committed
fine tune and fix lint
1 parent 6802be3 commit 3fc0346

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

cmd/config.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ $ ./gitea config edit-ini --config app.ini --config-keep-keys app-template.ini -
6969
},
7070
&cli.BoolFlag{
7171
Name: "in-place",
72-
Usage: "Output to the same config file as input.",
72+
Usage: "Output to the same config file as input. This flag will be ignored if --out is set.",
7373
},
7474
&cli.StringFlag{
7575
Name: "out",
@@ -103,15 +103,11 @@ func runConfigUpdateIni(_ context.Context, c *cli.Command) error {
103103

104104
inPlace := c.Bool("in-place")
105105
configFileOut := c.String("out")
106-
if inPlace {
107-
if configFileOut != "" {
108-
return errors.New("cannot use --in-place and --out together")
109-
}
110-
configFileOut = configFileIn
111-
} else {
112-
if configFileOut == "" {
106+
if configFileOut == "" {
107+
if !inPlace {
113108
return errors.New("either --in-place or --out must be specified")
114109
}
110+
configFileOut = configFileIn // in-place edit
115111
}
116112

117113
needWriteOut := configFileOut != configFileIn

0 commit comments

Comments
 (0)