summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authordigitalcraftsman <digitalcraftsman@users.noreply.github.com>2015-11-23 20:44:59 +0100
committerSteve Francia <steve.francia@gmail.com>2016-01-01 14:46:40 -0500
commit47587321d9a153ef4158739e8f238c850fb1ee7a (patch)
tree1fc48bfcfe2c93096f0e84b9dcc291ef49606b71 /commands
parent40fccf2251a7187f002165653d42178e2f53a49b (diff)
Add themesDir option to configuration
themesDir can be used to change the default path of the themes folder. Fixes 1556
Diffstat (limited to 'commands')
-rw-r--r--commands/hugo.go3
-rw-r--r--commands/new.go4
2 files changed, 4 insertions, 3 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index 1f86baa2b..ff10ddde6 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -210,6 +210,7 @@ func LoadDefaultSettings() {
viper.SetDefault("ArchetypeDir", "archetypes")
viper.SetDefault("PublishDir", "public")
viper.SetDefault("DataDir", "data")
+ viper.SetDefault("ThemesDir", "themes")
viper.SetDefault("DefaultLayout", "post")
viper.SetDefault("BuildDrafts", false)
viper.SetDefault("BuildFuture", false)
@@ -514,7 +515,7 @@ func getDirList() []string {
filepath.Walk(helpers.AbsPathify(viper.GetString("LayoutDir")), walker)
filepath.Walk(helpers.AbsPathify(viper.GetString("StaticDir")), walker)
if helpers.ThemeSet() {
- filepath.Walk(helpers.AbsPathify("themes/"+viper.GetString("theme")), walker)
+ filepath.Walk(helpers.AbsPathify(viper.GetString("themesDir")+"/"+viper.GetString("theme")), walker)
}
return a
diff --git a/commands/new.go b/commands/new.go
index a30c9f55b..8c2e4850f 100644
--- a/commands/new.go
+++ b/commands/new.go
@@ -176,8 +176,8 @@ func NewTheme(cmd *cobra.Command, args []string) error {
return newUserError("theme name needs to be provided")
}
- createpath := helpers.AbsPathify(filepath.Join("themes", args[0]))
- jww.INFO.Println("Creating theme at", createpath)
+ createpath := helpers.AbsPathify(filepath.Join(viper.GetString("themesDir"), args[0]))
+ jww.INFO.Println("creating theme at", createpath)
if x, _ := helpers.Exists(createpath, hugofs.SourceFs); x {
return newUserError(createpath, "already exists")