Merge pull request #916 from starius/loop-cli-prevent-unknown-flags

cmd/loop: crash if unknown flags are provided
This commit is contained in:
Boris Nagaev 2025-04-05 15:24:29 -03:00 committed by GitHub
commit ec2bf44e46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View file

@ -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",

View file

@ -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.

View file

@ -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: