fix -v verbose flag (it was being used by the default --version flag).

This commit is contained in:
fiatjaf
2025-01-30 19:58:17 -03:00
parent df5ebd3f56
commit e2dd3ca544
2 changed files with 10 additions and 5 deletions

View File

@@ -214,11 +214,13 @@ func leftPadKey(k string) string {
}
var colors = struct {
reset func(...any) (int, error)
italic func(...any) string
italicf func(string, ...any) string
bold func(...any) string
boldf func(string, ...any) string
}{
color.New(color.Reset).Print,
color.New(color.Italic).Sprint,
color.New(color.Italic).Sprintf,
color.New(color.Bold).Sprint,

13
main.go
View File

@@ -7,7 +7,6 @@ import (
"os"
"path/filepath"
"github.com/fatih/color"
"github.com/fiatjaf/cli/v3"
"github.com/nbd-wtf/go-nostr"
"github.com/nbd-wtf/go-nostr/sdk"
@@ -133,12 +132,16 @@ var app = &cli.Command{
}
func main() {
defer func() {
color.New(color.Reset).Print()
}()
defer colors.reset()
cli.VersionFlag = &cli.BoolFlag{
Name: "version",
Usage: "prints the version",
}
if err := app.Run(context.Background(), os.Args); err != nil {
stdout(err)
color.New(color.Reset).Print()
colors.reset()
os.Exit(1)
}
}