From f8eb7d58ba3cfae3c037f333fbadb1a80600da1d Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Tue, 27 May 2025 20:30:29 +0200 Subject: [PATCH] add flag normalization Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/main.go b/main.go index f9ee1b6..572fdef 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "context" "os" + "strings" ghrecon "github.com/anotherhadi/gh-recon/gh-recon" "github.com/charmbracelet/log" @@ -10,6 +11,15 @@ import ( flag "github.com/spf13/pflag" ) +func wordSepNormalizeFunc(f *flag.FlagSet, name string) flag.NormalizedName { + from := []string{".", "_"} + to := "-" + for _, sep := range from { + name = strings.ReplaceAll(name, sep, to) + } + return flag.NormalizedName(name) +} + func main() { var username string var token string @@ -59,6 +69,7 @@ func main() { "", "Exclude repos from deep scan (comma-separated list)", ) + flag.CommandLine.SetNormalizeFunc(wordSepNormalizeFunc) flag.Parse() styles := log.DefaultStyles()