summaryrefslogtreecommitdiffstats
path: root/commands/hugo.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-02-18 10:02:12 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-02-18 22:53:23 +0100
commit6d2281c8ead70ac07122027c989807c0aa1a7722 (patch)
tree33686a2048a58f59954d8e1bb64a5cd3f8476af7 /commands/hugo.go
parente096917f8738404696627a279277820dbe3a8f94 (diff)
hugolib: Add disableKinds option
Fixes #2534
Diffstat (limited to 'commands/hugo.go')
-rw-r--r--commands/hugo.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index 3e8351658..95e1c5864 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -153,6 +153,7 @@ var (
themesDir string
source string
logI18nWarnings bool
+ disableKinds []string
)
// Execute adds all child commands to the root command HugoCmd and sets flags appropriately.
@@ -239,6 +240,8 @@ func initHugoBuildCommonFlags(cmd *cobra.Command) {
cmd.Flags().BoolP("noChmod", "", false, "Don't sync permission mode of files")
cmd.Flags().BoolVarP(&logI18nWarnings, "i18n-warnings", "", false, "Print missing translations")
+ cmd.Flags().StringSliceVar(&disableKinds, "disableKinds", []string{}, "Disable different kind of pages (home, RSS etc.)")
+
// Set bash-completion.
// Each flag must first be defined before using the SetAnnotation() call.
cmd.Flags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{})
@@ -290,6 +293,10 @@ func InitializeConfig(subCmdVs ...*cobra.Command) (*deps.DepsCfg, error) {
c.initializeFlags(cmdV)
}
+ if len(disableKinds) > 0 {
+ c.Set("disableKinds", disableKinds)
+ }
+
logger, err := createLogger(cfg.Cfg)
if err != nil {
return cfg, err
@@ -450,6 +457,7 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) {
for _, key := range flagKeys {
c.setValueFromFlag(cmd.Flags(), key)
}
+
}
func (c *commandeer) setValueFromFlag(flags *flag.FlagSet, key string) {