mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-25 22:00:58 +02:00
@@ -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) {
|
||||
|
Reference in New Issue
Block a user