From dab963a79728f622a582465a33c49a9fb7183fc4 Mon Sep 17 00:00:00 2001 From: Fabiano Franz Date: Wed, 4 Nov 2015 14:40:11 -0500 Subject: [PATCH] Persistent flags should also be used in completions --- bash_completions.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bash_completions.go b/bash_completions.go index 2cea735b..113bb311 100644 --- a/bash_completions.go +++ b/bash_completions.go @@ -305,6 +305,12 @@ func writeFlags(cmd *Command, out *bytes.Buffer) { writeShortFlag(flag, out) } }) + cmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) { + writeFlag(flag, out) + if len(flag.Shorthand) > 0 { + writeShortFlag(flag, out) + } + }) fmt.Fprintf(out, "\n") }