MCPcopy
hub / github.com/spf13/pflag / aliasAndWordSepFlagNames

Function aliasAndWordSepFlagNames

flag_test.go:802–815  ·  view source on GitHub ↗
(f *FlagSet, name string)

Source from the content-addressed store, hash-verified

800}
801
802func aliasAndWordSepFlagNames(f *FlagSet, name string) NormalizedName {
803 seps := []string{"-", "_"}
804
805 oldName := replaceSeparators("old-valid_flag", seps, ".")
806 newName := replaceSeparators("valid-flag", seps, ".")
807
808 name = replaceSeparators(name, seps, ".")
809 switch name {
810 case oldName:
811 name = newName
812 }
813
814 return NormalizedName(name)
815}
816
817func TestCustomNormalizedNames(t *testing.T) {
818 f := NewFlagSet("normalized", ContinueOnError)

Callers

nothing calls this directly

Calls 2

replaceSeparatorsFunction · 0.85
NormalizedNameTypeAlias · 0.85

Tested by

no test coverage detected