mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
cmd/loop: crash if unknown flags are provided
Verify the number of positional arguments if they were provided to crash in such scenarios: $ loop out 250000 --xxx $ loop in 250000 1000 These commands used to work ignoring the last argument.
This commit is contained in:
parent
bfe7991c4e
commit
023ac009c0
3 changed files with 3 additions and 3 deletions
|
|
@ -46,7 +46,7 @@ var setLiquidityRuleCommand = cli.Command{
|
|||
Name: "setrule",
|
||||
Usage: "set liquidity manager rule for a channel/peer",
|
||||
Description: "Update or remove the liquidity rule for a channel/peer.",
|
||||
ArgsUsage: "{shortchanid | peerpubkey}",
|
||||
ArgsUsage: "{shortchanid | peerpubkey}",
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "type",
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ func loopIn(ctx *cli.Context) error {
|
|||
switch {
|
||||
case ctx.IsSet("amt"):
|
||||
amtStr = ctx.String("amt")
|
||||
case ctx.NArg() > 0:
|
||||
case ctx.NArg() == 1:
|
||||
amtStr = args[0]
|
||||
default:
|
||||
// Show command help if no arguments and flags were provided.
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ func loopOut(ctx *cli.Context) error {
|
|||
switch {
|
||||
case ctx.IsSet("amt"):
|
||||
amtStr = ctx.String("amt")
|
||||
case ctx.NArg() > 0:
|
||||
case ctx.NArg() == 1 || ctx.NArg() == 2:
|
||||
amtStr = args[0]
|
||||
args = args.Tail()
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue