Use spf13/pflag's new SetAnnotation helper

And make our bash completion code more compact.
This commit is contained in:
Anthony Fok authored and Bjørn Erik Pedersen committed 2015-08-09 17:56:15 +02:00
1 parent 209166a261
commit fee5519129
1 file changed
+1 -3
+1 -3
View File
@@ -111,9 +111,7 @@ func init() {
// for Bash autocomplete // for Bash autocomplete
validConfigFilenames := []string{"json", "js", "yaml", "yml", "toml", "tml"} validConfigFilenames := []string{"json", "js", "yaml", "yml", "toml", "tml"}
annotation := make(map[string][]string) HugoCmd.PersistentFlags().SetAnnotation("config", cobra.BashCompFilenameExt, validConfigFilenames)
annotation[cobra.BashCompFilenameExt] = validConfigFilenames
HugoCmd.PersistentFlags().Lookup("config").Annotations = annotation
// This message will be shown to Windows users if Hugo is opened from explorer.exe // This message will be shown to Windows users if Hugo is opened from explorer.exe
cobra.MousetrapHelpText = ` cobra.MousetrapHelpText = `