Skip to content

Commit

Permalink
fix crash of pay command if no argument is provided (#43)
Browse files Browse the repository at this point in the history
Also, extend the usage string accordingly with the mandatory
`<invoice>` parameter.
  • Loading branch information
theStack committed Apr 27, 2023
1 parent 540cfad commit c6485ce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/cashu/feni/pay.go
Expand Up @@ -16,7 +16,7 @@ func init() {
}

var payCommand = &cobra.Command{
Use: "pay",
Use: "pay <invoice>",
Short: "Pay lightning invoice",
Long: `Pay a lightning invoice using cashu tokens.`,
PreRun: PreRunFeni,
Expand Down Expand Up @@ -51,6 +51,10 @@ func ask(cmd *cobra.Command) bool {
return false
}
func pay(cmd *cobra.Command, args []string) {
if len(args) != 1 {
cmd.Help()
return
}
invoice := args[0]
fee, err := Wallet.client.CheckFee(cashu.CheckFeesRequest{Pr: invoice})
if err != nil {
Expand Down

0 comments on commit c6485ce

Please sign in to comment.