Skip to content

Commit 52e7117

Browse files
committed
Use flagset's NArg() and Arg() methods instead of global flag NArg() and Arg() for sub-commands
Fixes: #467
1 parent 8a56273 commit 52e7117

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

internal/cli/main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ Database drivers: `+strings.Join(database.List(), ", ")+"\n", createUsage, gotoU
198198
log.fatalErr(migraterErr)
199199
}
200200

201-
if flag.NArg() == 0 {
201+
if gotoSet.NArg() == 0 {
202202
log.fatal("error: please specify version argument V")
203203
}
204204

205-
v, err := strconv.ParseUint(flag.Arg(1), 10, 64)
205+
v, err := strconv.ParseUint(gotoSet.Arg(0), 10, 64)
206206
if err != nil {
207207
log.fatal("error: can't read version argument V")
208208
}
@@ -229,8 +229,8 @@ Database drivers: `+strings.Join(database.List(), ", ")+"\n", createUsage, gotoU
229229
}
230230

231231
limit := -1
232-
if flag.NArg() > 0 {
233-
n, err := strconv.ParseUint(flag.Arg(1), 10, 64)
232+
if upSet.NArg() > 0 {
233+
n, err := strconv.ParseUint(upSet.Arg(0), 10, 64)
234234
if err != nil {
235235
log.fatal("error: can't read limit argument N")
236236
}
@@ -333,11 +333,11 @@ Database drivers: `+strings.Join(database.List(), ", ")+"\n", createUsage, gotoU
333333
log.fatalErr(migraterErr)
334334
}
335335

336-
if flag.NArg() == 0 {
336+
if forceSet.NArg() == 0 {
337337
log.fatal("error: please specify version argument V")
338338
}
339339

340-
v, err := strconv.ParseInt(flag.Arg(1), 10, 64)
340+
v, err := strconv.ParseInt(forceSet.Arg(0), 10, 64)
341341
if err != nil {
342342
log.fatal("error: can't read version argument V")
343343
}

0 commit comments

Comments
 (0)