Skip to content

Commit 643cdc2

Browse files
committed
cmd/commands: export StripPrefix
1 parent 66366a0 commit 643cdc2

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
@@ -307,7 +307,7 @@ func decodePayReq(ctx *cli.Context) error {
307307
}
308308

309309
resp, err := client.DecodePayReq(ctxc, &lnrpc.PayReqString{
310-
PayReq: stripPrefix(payreq),
310+
PayReq: StripPrefix(payreq),
311311
})
312312
if err != nil {
313313
return err

cmd/commands/cmd_payments.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ func sendPayment(ctx *cli.Context) error {
325325
// details of the payment are encoded within the request.
326326
if ctx.IsSet("pay_req") {
327327
req := &routerrpc.SendPaymentRequest{
328-
PaymentRequest: stripPrefix(ctx.String("pay_req")),
328+
PaymentRequest: StripPrefix(ctx.String("pay_req")),
329329
Amt: ctx.Int64("amt"),
330330
DestCustomRecords: make(map[uint64][]byte),
331331
}
@@ -883,7 +883,7 @@ func payInvoice(ctx *cli.Context) error {
883883
}
884884

885885
req := &routerrpc.SendPaymentRequest{
886-
PaymentRequest: stripPrefix(payReq),
886+
PaymentRequest: StripPrefix(payReq),
887887
Amt: ctx.Int64("amt"),
888888
DestCustomRecords: make(map[uint64][]byte),
889889
}
@@ -1870,7 +1870,7 @@ func estimateRouteFee(ctx *cli.Context) error {
18701870
req.AmtSat = amtSat
18711871

18721872
case ctx.IsSet("pay_req"):
1873-
req.PaymentRequest = stripPrefix(ctx.String("pay_req"))
1873+
req.PaymentRequest = StripPrefix(ctx.String("pay_req"))
18741874
if ctx.IsSet("timeout") {
18751875
req.Timeout = uint32(ctx.Duration("timeout").Seconds())
18761876
}

0 commit comments

Comments
 (0)