Allow to set cache dir in config file

This commit is contained in:
Dimitri Merejkowsky 2016-10-09 11:00:36 +02:00 committed by Bjørn Erik Pedersen
parent 3616fb629b
commit 56512e816f
2 changed files with 7 additions and 0 deletions

View file

@ -372,6 +372,11 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
viper.Set("LayoutDir", layoutDir) viper.Set("LayoutDir", layoutDir)
} }
if cacheDir != "" {
viper.Set("CacheDir", cacheDir)
}
cacheDir = viper.GetString("cacheDir")
if cacheDir != "" { if cacheDir != "" {
if helpers.FilePathSeparator != cacheDir[len(cacheDir)-1:] { if helpers.FilePathSeparator != cacheDir[len(cacheDir)-1:] {
cacheDir = cacheDir + helpers.FilePathSeparator cacheDir = cacheDir + helpers.FilePathSeparator

View file

@ -103,6 +103,8 @@ temporary directory.
With the command-line flag `--cacheDir`, you can specify any folder on With the command-line flag `--cacheDir`, you can specify any folder on
your system as a caching directory. your system as a caching directory.
You can also set `cacheDir` in the main configuration file.
If you don't like caching at all, you can fully disable caching with the If you don't like caching at all, you can fully disable caching with the
command line flag `--ignoreCache`. command line flag `--ignoreCache`.