add flag normalization

Signed-off-by: Hadi <[email protected]>
This commit is contained in:
Hadi
2025-05-27 20:30:29 +02:00
parent 637d9811f2
commit f8eb7d58ba
+11
View File
@@ -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()