commands: Add buildExpired flag
authorHanchen Wang <hanchen.wang@mail.utoronto.ca>
Wed, 11 May 2016 14:10:35 +0000 (10:10 -0400)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 14 Jun 2016 13:45:26 +0000 (15:45 +0200)
commands/hugo.go

index 5ec3dc58251ce328e132950fc4b8428167f497e3..d979c3c629f38fd798454adcecf283ae926c1846 100644 (file)
@@ -134,6 +134,7 @@ var (
        draft                 bool
        forceSync             bool
        future                bool
+       expired               bool
        ignoreCache           bool
        logging               bool
        noTimes               bool
@@ -216,6 +217,7 @@ func initHugoBuildCommonFlags(cmd *cobra.Command) {
        cmd.Flags().BoolVar(&cleanDestination, "cleanDestinationDir", false, "Remove files from destination not found in static directories")
        cmd.Flags().BoolVarP(&draft, "buildDrafts", "D", false, "include content marked as draft")
        cmd.Flags().BoolVarP(&future, "buildFuture", "F", false, "include content with publishdate in the future")
+       cmd.Flags().BoolVarP(&expired, "buildExpired", "E", false, "include expired content")
        cmd.Flags().BoolVar(&disable404, "disable404", false, "Do not render 404 page")
        cmd.Flags().BoolVar(&disableRSS, "disableRSS", false, "Do not build RSS files")
        cmd.Flags().BoolVar(&disableSitemap, "disableSitemap", false, "Do not build Sitemap file")
@@ -283,6 +285,7 @@ func loadDefaultSettings() {
        viper.SetDefault("DefaultLayout", "post")
        viper.SetDefault("BuildDrafts", false)
        viper.SetDefault("BuildFuture", false)
+       viper.SetDefault("BuildExpired", false)
        viper.SetDefault("UglyURLs", false)
        viper.SetDefault("Verbose", false)
        viper.SetDefault("IgnoreCache", false)
@@ -357,6 +360,9 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
                if flagChanged(cmdV.Flags(), "buildFuture") {
                        viper.Set("BuildFuture", future)
                }
+               if flagChanged(cmdV.Flags(), "buildExpired") {
+                       viper.Set("BuildExpired", expired)
+               }
                if flagChanged(cmdV.Flags(), "uglyURLs") {
                        viper.Set("UglyURLs", uglyURLs)
                }