Add comment about commaWhitespace stripping of flag.Name

This commit is contained in:
Dan Buch 2016-05-24 04:00:37 -04:00
parent 42bdb31055
commit 2b288769c7
No known key found for this signature in database
GPG Key ID: FAEF12936DD3E3EC

View File

@ -614,6 +614,10 @@ func flagNames(f Flag) []string {
aliases := flagStringSliceField(f, "Aliases")
for _, part := range append([]string{name}, aliases...) {
// v1 -> v2 migration warning zone:
// Strip off anything after the first found comma or space, which
// *hopefully* makes it a tiny bit more obvious that unexpected behavior is
// caused by using the v1 form of stringly typed "Name".
ret = append(ret, commaWhitespace.ReplaceAllString(part, ""))
}