Skip to content

Commit 0569341

Browse files
authored
Merge pull request #436 from arshbot/assume-yes
main: add --force to loop in/loop out
2 parents 2e6adea + e52f6ef commit 0569341

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

cmd/loop/loopin.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ var (
3232
labels.MaxLength, labels.Reserved),
3333
}
3434

35+
forceFlag = cli.BoolFlag{
36+
Name: "force, f",
37+
Usage: "Assumes yes during confirmation. Using this option will result in an immediate swap",
38+
}
39+
3540
loopInCommand = cli.Command{
3641
Name: "in",
3742
Usage: "perform an on-chain to off-chain swap (loop in)",
@@ -60,6 +65,7 @@ var (
6065
confTargetFlag,
6166
lastHopFlag,
6267
labelFlag,
68+
forceFlag,
6369
verboseFlag,
6470
},
6571
Action: loopIn,
@@ -148,9 +154,13 @@ func loopIn(ctx *cli.Context) error {
148154
}
149155

150156
limits := getInLimits(quote)
151-
err = displayInDetails(quoteReq, quote, ctx.Bool("verbose"))
152-
if err != nil {
153-
return err
157+
158+
// Skip showing details if configured
159+
if !(ctx.Bool("force") || ctx.Bool("f")) {
160+
err = displayInDetails(quoteReq, quote, ctx.Bool("verbose"))
161+
if err != nil {
162+
return err
163+
}
154164
}
155165

156166
req := &looprpc.LoopInRequest{

cmd/loop/loopout.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ var loopOutCommand = cli.Command{
7373
"Not setting this flag therefore might " +
7474
"result in a lower swap fee.",
7575
},
76+
forceFlag,
7677
labelFlag,
7778
verboseFlag,
7879
},
@@ -176,11 +177,15 @@ func loopOut(ctx *cli.Context) error {
176177
ctx.Int64("max_swap_routing_fee"),
177178
)
178179
}
179-
err = displayOutDetails(
180-
limits, warning, quoteReq, quote, ctx.Bool("verbose"),
181-
)
182-
if err != nil {
183-
return err
180+
181+
// Skip showing details if configured
182+
if !(ctx.Bool("force") || ctx.Bool("f")) {
183+
err = displayOutDetails(
184+
limits, warning, quoteReq, quote, ctx.Bool("verbose"),
185+
)
186+
if err != nil {
187+
return err
188+
}
184189
}
185190

186191
resp, err := client.LoopOut(context.Background(), &looprpc.LoopOutRequest{

0 commit comments

Comments
 (0)