ref: fee5519129948d29584341f865e9e8cbe5668b83
parent: 209166a261621b3ed4e25db252914bcd71054d31
author: Anthony Fok <[email protected]>
date: Fri Aug 7 18:50:36 EDT 2015
Use spf13/pflag's new SetAnnotation helper And make our bash completion code more compact.
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -111,9 +111,7 @@
// 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 = `