ref: 29c9a40a8d5defbe69c38e9997313ce27df55eaf
parent: 7555e364d069b1ea34e8c5be1c3337c7e2753c56
author: Anthony Fok <[email protected]>
date: Sun Aug 9 14:49:54 EDT 2015
Implement `hugo --theme=[Tab][Tab]` bash completion using the new BashCompSubdirsInDir annotation in spf13/cobra.
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -112,6 +112,7 @@
// for Bash autocomplete
validConfigFilenames := []string{"json", "js", "yaml", "yml", "toml", "tml"}
HugoCmd.PersistentFlags().SetAnnotation("config", cobra.BashCompFilenameExt, validConfigFilenames)
+ HugoCmd.PersistentFlags().SetAnnotation("theme", cobra.BashCompSubdirsInDir, []string{"themes"})
// This message will be shown to Windows users if Hugo is opened from explorer.exe
cobra.MousetrapHelpText = `