command: Add `themesDir` command argument to specify themes directory
authoravi <hi@avi.im>
Thu, 22 Dec 2016 07:39:58 +0000 (13:09 +0530)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 22 Dec 2016 08:33:08 +0000 (09:33 +0100)
commands/hugo.go

index f5f5ef462f8bcf542df34577d5f422e29f06bbff..153980cb10e140af31fe9a7ee5712dfc91f7d16c 100644 (file)
@@ -146,6 +146,7 @@ var (
        destination string
        logFile     string
        theme       string
+       themesDir   string
        source      string
 )
 
@@ -219,6 +220,7 @@ func initHugoBuildCommonFlags(cmd *cobra.Command) {
        cmd.Flags().BoolP("ignoreCache", "", false, "Ignores the cache directory")
        cmd.Flags().StringVarP(&destination, "destination", "d", "", "filesystem path to write files to")
        cmd.Flags().StringVarP(&theme, "theme", "t", "", "theme to use (located in /themes/THEMENAME/)")
+       cmd.Flags().StringVarP(&themesDir, "themesDir", "", "", "filesystem path to themes directory")
        cmd.Flags().Bool("uglyURLs", false, "if true, use /filename.html instead of /filename/")
        cmd.Flags().Bool("canonifyURLs", false, "if true, all relative URLs will be canonicalized using baseURL")
        cmd.Flags().StringVarP(&baseURL, "baseURL", "b", "", "hostname (and path) to the root, e.g. http://spf13.com/")
@@ -287,6 +289,10 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
                viper.Set("theme", theme)
        }
 
+       if themesDir != "" {
+               viper.Set("themesDir", themesDir)
+       }
+
        if destination != "" {
                viper.Set("publishDir", destination)
        }