Skip to content

Commit f05b0e6

Browse files
committed
cmd: positional amount flag for staticaddr loop-in
1 parent 2548522 commit f05b0e6

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

cmd/loop/staticaddr.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,23 @@ func staticAddressLoopIn(ctx *cli.Context) error {
506506
return cli.ShowCommandHelp(ctx, "in")
507507
}
508508

509+
var selectedAmount int64
510+
switch {
511+
case ctx.NArg() == 1:
512+
amt, err := parseAmt(ctx.Args().Get(0))
513+
if err != nil {
514+
return err
515+
}
516+
selectedAmount = int64(amt)
517+
518+
case ctx.NArg() > 1:
519+
return fmt.Errorf("only a single positional argument is " +
520+
"allowed")
521+
522+
default:
523+
selectedAmount = ctx.Int64("amount")
524+
}
525+
509526
client, cleanup, err := getClient(ctx)
510527
if err != nil {
511528
return err
@@ -516,7 +533,6 @@ func staticAddressLoopIn(ctx *cli.Context) error {
516533
ctxb = context.Background()
517534
isAllSelected = ctx.IsSet("all")
518535
isUtxoSelected = ctx.IsSet("utxo")
519-
selectedAmount = ctx.Int64("amount")
520536
autoSelectDepositsForQuote bool
521537
label = ctx.String("static-loop-in")
522538
hints []*swapserverrpc.RouteHint

0 commit comments

Comments
 (0)