You've already forked registry-auth
mirror of
https://github.com/alauda/registry-auth.git
synced 2026-10-25 01:19:23 +03:00
19 lines
433 B
Go
19 lines
433 B
Go
package app
|
|
|
|
import (
|
|
"github.com/spf13/pflag"
|
|
"strings"
|
|
)
|
|
|
|
func initFlag() {
|
|
pflag.CommandLine.SetNormalizeFunc(WordSepNormalizeFunc)
|
|
}
|
|
|
|
// WordSepNormalizeFunc changes all flags that contain "_" separators.
|
|
func WordSepNormalizeFunc(_ *pflag.FlagSet, name string) pflag.NormalizedName {
|
|
if strings.Contains(name, "_") {
|
|
return pflag.NormalizedName(strings.Replace(name, "_", "-", -1))
|
|
}
|
|
return pflag.NormalizedName(name)
|
|
}
|