Skip to content

Commit c5973aa

Browse files
committed
cmd/commands: export StripPrefix
1 parent efbaf90 commit c5973aa

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

cmd/commands/arg_parse.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func parseTime(s string, base time.Time) (uint64, error) {
4242

4343
var lightningPrefix = "lightning:"
4444

45-
// stripPrefix removes accidentally copied 'lightning:' prefix.
46-
func stripPrefix(s string) string {
45+
// StripPrefix removes accidentally copied 'lightning:' prefix.
46+
func StripPrefix(s string) string {
4747
return strings.TrimSpace(strings.TrimPrefix(s, lightningPrefix))
4848
}

cmd/commands/arg_parse_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func TestStripPrefix(t *testing.T) {
111111
t.Parallel()
112112

113113
for _, test := range stripPrefixTests {
114-
actual := stripPrefix(test.in)
114+
actual := StripPrefix(test.in)
115115
require.Equal(t, test.expected, actual)
116116
}
117117
}

cmd/commands/cmd_invoice.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ func decodePayReq(ctx *cli.Context) error {
408408
}
409409

410410
resp, err := client.DecodePayReq(ctxc, &lnrpc.PayReqString{
411-
PayReq: stripPrefix(payreq),
411+
PayReq: StripPrefix(payreq),
412412
})
413413
if err != nil {
414414
return err

cmd/commands/cmd_payments.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ func SendPayment(ctx *cli.Context) error {
341341
// details of the payment are encoded within the request.
342342
if ctx.IsSet("pay_req") {
343343
req := &routerrpc.SendPaymentRequest{
344-
PaymentRequest: stripPrefix(ctx.String("pay_req")),
344+
PaymentRequest: StripPrefix(ctx.String("pay_req")),
345345
Amt: ctx.Int64("amt"),
346346
DestCustomRecords: make(map[uint64][]byte),
347347
Amp: ctx.Bool(ampFlag.Name),
@@ -920,7 +920,7 @@ func payInvoice(ctx *cli.Context) error {
920920
}
921921

922922
req := &routerrpc.SendPaymentRequest{
923-
PaymentRequest: stripPrefix(payReq),
923+
PaymentRequest: StripPrefix(payReq),
924924
Amt: ctx.Int64("amt"),
925925
DestCustomRecords: make(map[uint64][]byte),
926926
Amp: ctx.Bool(ampFlag.Name),
@@ -1922,7 +1922,7 @@ func estimateRouteFee(ctx *cli.Context) error {
19221922
req.AmtSat = amtSat
19231923

19241924
case ctx.IsSet("pay_req"):
1925-
req.PaymentRequest = stripPrefix(ctx.String("pay_req"))
1925+
req.PaymentRequest = StripPrefix(ctx.String("pay_req"))
19261926
if ctx.IsSet("timeout") {
19271927
req.Timeout = uint32(ctx.Duration("timeout").Seconds())
19281928
}

0 commit comments

Comments
 (0)