From 8fc369c7004a8aadf0394111392d7520e39bf367 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") }