diff --git a/bunker.go b/bunker.go index 73fef86..a1eedba 100644 --- a/bunker.go +++ b/bunker.go @@ -11,7 +11,7 @@ import ( "time" "github.com/fatih/color" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/nip19" "github.com/nbd-wtf/go-nostr/nip46" diff --git a/count.go b/count.go index 1ca9596..4599c0b 100644 --- a/count.go +++ b/count.go @@ -6,7 +6,7 @@ import ( "os" "strings" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/nip45" "github.com/nbd-wtf/go-nostr/nip45/hyperloglog" diff --git a/curl.go b/curl.go index 52fe474..9250898 100644 --- a/curl.go +++ b/curl.go @@ -8,7 +8,7 @@ import ( "os/exec" "strings" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/nbd-wtf/go-nostr" "golang.org/x/exp/slices" ) diff --git a/decode.go b/decode.go index 4b9a139..4ad2b13 100644 --- a/decode.go +++ b/decode.go @@ -5,7 +5,7 @@ import ( "encoding/hex" "strings" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/nip19" "github.com/nbd-wtf/go-nostr/sdk" diff --git a/encode.go b/encode.go index e1e44a0..c8dd419 100644 --- a/encode.go +++ b/encode.go @@ -4,9 +4,9 @@ import ( "context" "fmt" - "github.com/fiatjaf/cli/v3" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/nip19" + "github.com/urfave/cli/v3" ) var encode = &cli.Command{ @@ -19,11 +19,11 @@ var encode = &cli.Command{ nak encode nevent <event-id> nak encode nevent --author <pubkey-hex> --relay <relay-url> --relay <other-relay> <event-id> nak encode nsec <privkey-hex>`, - Before: func(ctx context.Context, c *cli.Command) error { + Before: func(ctx context.Context, c *cli.Command) (context.Context, error) { if c.Args().Len() < 1 { - return fmt.Errorf("expected more than 1 argument.") + return ctx, fmt.Errorf("expected more than 1 argument.") } - return nil + return ctx, nil }, DisableSliceFlagSeparator: true, Commands: []*cli.Command{ diff --git a/encrypt_decrypt.go b/encrypt_decrypt.go index b4cc5c5..930948a 100644 --- a/encrypt_decrypt.go +++ b/encrypt_decrypt.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/nip04" ) diff --git a/event.go b/event.go index d0ba01d..8d32bc1 100644 --- a/event.go +++ b/event.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/mailru/easyjson" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/nip13" diff --git a/fetch.go b/fetch.go index fb4c0ab..a2d141f 100644 --- a/fetch.go +++ b/fetch.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/nip05" "github.com/nbd-wtf/go-nostr/nip19" diff --git a/flags.go b/flags.go index 3de3d8f..e9ddbcc 100644 --- a/flags.go +++ b/flags.go @@ -6,7 +6,7 @@ import ( "strconv" "time" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/markusmobius/go-dateparser" "github.com/nbd-wtf/go-nostr" ) diff --git a/go.mod b/go.mod index e7ec183..2948186 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,6 @@ require ( github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 github.com/fatih/color v1.16.0 - github.com/fiatjaf/cli/v3 v3.0.0-20240723181502-e7dd498b16ae github.com/fiatjaf/eventstore v0.15.0 github.com/fiatjaf/khatru v0.15.0 github.com/json-iterator/go v1.1.12 @@ -18,6 +17,7 @@ require ( github.com/mark3labs/mcp-go v0.8.3 github.com/markusmobius/go-dateparser v1.2.3 github.com/nbd-wtf/go-nostr v0.50.0 + github.com/urfave/cli/v3 v3.0.0-beta1 golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 ) diff --git a/go.sum b/go.sum index 29d0121..037fea1 100644 --- a/go.sum +++ b/go.sum @@ -66,8 +66,6 @@ github.com/fasthttp/websocket v1.5.7 h1:0a6o2OfeATvtGgoMKleURhLT6JqWPg7fYfWnH4KH github.com/fasthttp/websocket v1.5.7/go.mod h1:bC4fxSono9czeXHQUVKxsC0sNjbm7lPJR04GDFqClfU= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= -github.com/fiatjaf/cli/v3 v3.0.0-20240723181502-e7dd498b16ae h1:0B/1dU3YECIbPoBIRTQ4c0scZCNz9TVHtQpiODGrTTo= -github.com/fiatjaf/cli/v3 v3.0.0-20240723181502-e7dd498b16ae/go.mod h1:aAWPO4bixZZxPtOnH6K3q4GbQ0jftUNDW9Oa861IRew= github.com/fiatjaf/eventstore v0.15.0 h1:5UXe0+vIb30/cYcOWipks8nR3g+X8W224TFy5yPzivk= github.com/fiatjaf/eventstore v0.15.0/go.mod h1:KAsld5BhkmSck48aF11Txu8X+OGNmoabw4TlYVWqInc= github.com/fiatjaf/khatru v0.15.0 h1:0aLWiTrdzoKD4WmW35GWL/Jsn4dACCUw325JKZg/AmI= @@ -164,6 +162,8 @@ github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JT github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/urfave/cli/v3 v3.0.0-beta1 h1:6DTaaUarcM0wX7qj5Hcvs+5Dm3dyUTBbEwIWAjcw9Zg= +github.com/urfave/cli/v3 v3.0.0-beta1/go.mod h1:FnIeEMYu+ko8zP1F9Ypr3xkZMIDqW3DR92yUtY39q1Y= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= diff --git a/helpers.go b/helpers.go index 9ae8ad5..106b8d7 100644 --- a/helpers.go +++ b/helpers.go @@ -15,7 +15,7 @@ import ( "time" "github.com/fatih/color" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" jsoniter "github.com/json-iterator/go" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/sdk" diff --git a/helpers_key.go b/helpers_key.go index 35511ab..d560001 100644 --- a/helpers_key.go +++ b/helpers_key.go @@ -9,7 +9,7 @@ import ( "github.com/chzyer/readline" "github.com/fatih/color" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/keyer" "github.com/nbd-wtf/go-nostr/nip19" diff --git a/key.go b/key.go index 2be2b8f..4ccd5cb 100644 --- a/key.go +++ b/key.go @@ -9,7 +9,7 @@ import ( "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcec/v2/schnorr/musig2" "github.com/decred/dcrd/dcrec/secp256k1/v4" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/nip19" "github.com/nbd-wtf/go-nostr/nip49" diff --git a/main.go b/main.go index 91aa68f..9fb116f 100644 --- a/main.go +++ b/main.go @@ -7,10 +7,10 @@ import ( "os" "path/filepath" - "github.com/fiatjaf/cli/v3" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/sdk" "github.com/nbd-wtf/go-nostr/sdk/hints/memoryh" + "github.com/urfave/cli/v3" ) var version string = "debug" @@ -19,7 +19,6 @@ var app = &cli.Command{ Name: "nak", Suggest: true, UseShortOptionHandling: true, - AllowFlagsAfterArguments: true, Usage: "the nostr army knife command-line tool", DisableSliceFlagSeparator: true, Commands: []*cli.Command{ @@ -44,15 +43,13 @@ var app = &cli.Command{ Version: version, Flags: []cli.Flag{ &cli.StringFlag{ - Name: "config-path", - Hidden: true, - Persistent: true, + Name: "config-path", + Hidden: true, }, &cli.BoolFlag{ - Name: "quiet", - Usage: "do not print logs and info messages to stderr, use -qq to also not print anything to stdout", - Aliases: []string{"q"}, - Persistent: true, + Name: "quiet", + Usage: "do not print logs and info messages to stderr, use -qq to also not print anything to stdout", + Aliases: []string{"q"}, Action: func(ctx context.Context, c *cli.Command, b bool) error { q := c.Count("quiet") if q >= 1 { @@ -65,10 +62,9 @@ var app = &cli.Command{ }, }, &cli.BoolFlag{ - Name: "verbose", - Usage: "print more stuff than normally", - Aliases: []string{"v"}, - Persistent: true, + Name: "verbose", + Usage: "print more stuff than normally", + Aliases: []string{"v"}, Action: func(ctx context.Context, c *cli.Command, b bool) error { v := c.Count("verbose") if v >= 1 { @@ -78,7 +74,7 @@ var app = &cli.Command{ }, }, }, - Before: func(ctx context.Context, c *cli.Command) error { + Before: func(ctx context.Context, c *cli.Command) (context.Context, error) { configPath := c.String("config-path") if configPath == "" { if home, err := os.UserHomeDir(); err == nil { @@ -117,7 +113,7 @@ var app = &cli.Command{ ), ) - return nil + return ctx, nil }, After: func(ctx context.Context, c *cli.Command) error { // save hints database on exit diff --git a/mcp.go b/mcp.go index bb56a4a..4eba105 100644 --- a/mcp.go +++ b/mcp.go @@ -6,7 +6,7 @@ import ( "os" "strings" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/mark3labs/mcp-go/mcp" "github.com/mark3labs/mcp-go/server" "github.com/nbd-wtf/go-nostr" diff --git a/outbox.go b/outbox.go index 7ee859e..284f148 100644 --- a/outbox.go +++ b/outbox.go @@ -6,7 +6,7 @@ import ( "os" "path/filepath" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/nbd-wtf/go-nostr" ) diff --git a/relay.go b/relay.go index afc9a44..36f5729 100644 --- a/relay.go +++ b/relay.go @@ -10,7 +10,7 @@ import ( "io" "net/http" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/nip11" "github.com/nbd-wtf/go-nostr/nip86" diff --git a/req.go b/req.go index dd719fc..d189db0 100644 --- a/req.go +++ b/req.go @@ -6,7 +6,7 @@ import ( "os" "strings" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/mailru/easyjson" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/nip77" diff --git a/serve.go b/serve.go index b06f61c..af0faea 100644 --- a/serve.go +++ b/serve.go @@ -10,7 +10,7 @@ import ( "github.com/bep/debounce" "github.com/fatih/color" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/fiatjaf/eventstore/slicestore" "github.com/fiatjaf/khatru" "github.com/nbd-wtf/go-nostr" diff --git a/verify.go b/verify.go index 5b584cb..bccd27e 100644 --- a/verify.go +++ b/verify.go @@ -3,7 +3,7 @@ package main import ( "context" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/nbd-wtf/go-nostr" ) diff --git a/wallet.go b/wallet.go index 87e5822..c6faacd 100644 --- a/wallet.go +++ b/wallet.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/fatih/color" - "github.com/fiatjaf/cli/v3" + "github.com/urfave/cli/v3" "github.com/nbd-wtf/go-nostr" "github.com/nbd-wtf/go-nostr/nip60" "github.com/nbd-wtf/go-nostr/nip61"