Don't complete hidden flags

This commit is contained in:
Yogesh Lonkar 2019-04-11 10:57:58 +05:30
parent 1d7a2b08d6
commit 62f02f21ef

View File

@ -199,6 +199,9 @@ func printFlagSuggestions(lastArg string, flags []Flag, writer io.Writer) {
cur := shortFlagRegex.ReplaceAllString(lastArg, "")
cur = shortFlagRegex.ReplaceAllString(cur, "")
for _, flag := range flags {
if bflag, ok := flag.(BoolFlag); ok && bflag.Hidden {
continue
}
for _, name := range strings.Split(flag.GetName(), ",") {
name = strings.Trim(name, " ")
count := utf8.RuneCountInString(name)