Use spf13/pflag's new SetAnnotation helper

And make our bash completion code more compact.
This commit is contained in:
Anthony Fok 2015-08-07 22:50:36 -06:00 committed by Bjørn Erik Pedersen
parent 209166a261
commit fee5519129

View file

@ -111,9 +111,7 @@ func init() {
// for Bash autocomplete
validConfigFilenames := []string{"json", "js", "yaml", "yml", "toml", "tml"}
annotation := make(map[string][]string)
annotation[cobra.BashCompFilenameExt] = validConfigFilenames
HugoCmd.PersistentFlags().Lookup("config").Annotations = annotation
HugoCmd.PersistentFlags().SetAnnotation("config", cobra.BashCompFilenameExt, validConfigFilenames)
// This message will be shown to Windows users if Hugo is opened from explorer.exe
cobra.MousetrapHelpText = `