mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
cafb784799
commit
0ab4162413
1 changed files with 12 additions and 0 deletions
|
@ -143,6 +143,8 @@ var (
|
|||
var (
|
||||
baseURL string
|
||||
cacheDir string
|
||||
contentDir string
|
||||
layoutDir string
|
||||
cfgFile string
|
||||
destination string
|
||||
logFile string
|
||||
|
@ -213,6 +215,8 @@ func initHugoBuildCommonFlags(cmd *cobra.Command) {
|
|||
cmd.Flags().BoolVar(&disableSitemap, "disableSitemap", false, "Do not build Sitemap file")
|
||||
cmd.Flags().BoolVar(&disableRobotsTXT, "disableRobotsTXT", false, "Do not build Robots TXT file")
|
||||
cmd.Flags().StringVarP(&source, "source", "s", "", "filesystem path to read files relative from")
|
||||
cmd.Flags().StringVarP(&contentDir, "contentDir", "c", "", "filesystem path to content directory")
|
||||
cmd.Flags().StringVarP(&layoutDir, "layoutDir", "l", "", "filesystem path to layout directory")
|
||||
cmd.Flags().StringVarP(&cacheDir, "cacheDir", "", "", "filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/")
|
||||
cmd.Flags().BoolVarP(&ignoreCache, "ignoreCache", "", false, "Ignores the cache directory for reading but still writes to it")
|
||||
cmd.Flags().StringVarP(&destination, "destination", "d", "", "filesystem path to write files to")
|
||||
|
@ -405,6 +409,14 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
|
|||
viper.Set("WorkingDir", dir)
|
||||
}
|
||||
|
||||
if contentDir != "" {
|
||||
viper.Set("ContentDir", contentDir)
|
||||
}
|
||||
|
||||
if layoutDir != "" {
|
||||
viper.Set("LayoutDir", layoutDir)
|
||||
}
|
||||
|
||||
if cacheDir != "" {
|
||||
if helpers.FilePathSeparator != cacheDir[len(cacheDir)-1:] {
|
||||
cacheDir = cacheDir + helpers.FilePathSeparator
|
||||
|
|
Loading…
Reference in a new issue