mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
Merge to stay up to date with current dev
Feature: GetJson and GetJson in short codes or other layout files. For more details please see: http://cyrillschumacher.com/2014/12/21/dynamic-pages-with-gohugo.io/
This commit is contained in:
@@ -56,7 +56,7 @@ var hugoCmdV *cobra.Command
|
||||
|
||||
//Flags that are to be added to commands.
|
||||
var BuildWatch, Draft, Future, UglyUrls, Verbose, Logging, VerboseLog, DisableRSS, DisableSitemap, PluralizeListTitles, NoTimes bool
|
||||
var Source, Destination, Theme, BaseUrl, CfgFile, LogFile, Editor string
|
||||
var Source, CacheDir, Destination, Theme, BaseUrl, CfgFile, LogFile, Editor string
|
||||
|
||||
//Execute adds all child commands to the root command HugoCmd and sets flags appropriately.
|
||||
func Execute() {
|
||||
@@ -83,6 +83,7 @@ func init() {
|
||||
HugoCmd.PersistentFlags().BoolVar(&DisableRSS, "disableRSS", false, "Do not build RSS files")
|
||||
HugoCmd.PersistentFlags().BoolVar(&DisableSitemap, "disableSitemap", false, "Do not build Sitemap file")
|
||||
HugoCmd.PersistentFlags().StringVarP(&Source, "source", "s", "", "filesystem path to read files relative from")
|
||||
HugoCmd.PersistentFlags().StringVarP(&CacheDir, "cacheDir", "", "$TMPDIR/hugo_cache/", "filesystem path to cache directory")
|
||||
HugoCmd.PersistentFlags().StringVarP(&Destination, "destination", "d", "", "filesystem path to write files to")
|
||||
HugoCmd.PersistentFlags().StringVarP(&Theme, "theme", "t", "", "theme to use (located in /themes/THEMENAME/)")
|
||||
HugoCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output")
|
||||
@@ -203,6 +204,15 @@ func InitializeConfig() {
|
||||
viper.Set("WorkingDir", dir)
|
||||
}
|
||||
|
||||
if CacheDir != "" {
|
||||
if helpers.FilePathSeparator != CacheDir[len(CacheDir)-1:] {
|
||||
CacheDir = CacheDir + helpers.FilePathSeparator
|
||||
}
|
||||
viper.Set("CacheDir", CacheDir)
|
||||
} else {
|
||||
viper.Set("CacheDir", helpers.GetTempDir("hugo_cache", hugofs.SourceFs))
|
||||
}
|
||||
|
||||
if VerboseLog || Logging || (viper.IsSet("LogFile") && viper.GetString("LogFile") != "") {
|
||||
if viper.IsSet("LogFile") && viper.GetString("LogFile") != "" {
|
||||
jww.SetLogFile(viper.GetString("LogFile"))
|
||||
|
Reference in New Issue
Block a user