aboutsummaryrefslogtreecommitdiffhomepage
path: root/commands/list.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2017-02-05 10:20:06 +0700
committerBjørn Erik Pedersen <[email protected]>2017-02-17 17:15:26 +0100
commit93ca7c9e958e34469a337e4efcc7c75774ec50fd (patch)
tree5dfa296cfe74fd5ef8f0d41ea4078704f453aa04 /commands/list.go
parente34af6ee30f70f5780a281e2fd8f4ed9b487ee61 (diff)
downloadhugo-93ca7c9e958e34469a337e4efcc7c75774ec50fd.tar.gz
hugo-93ca7c9e958e34469a337e4efcc7c75774ec50fd.zip
all: Refactor to nonglobal Viper, i18n etc.
This is a final rewrite that removes all the global state in Hugo, which also enables the use if `t.Parallel` in tests. Updates #2701 Fixes #3016
Diffstat (limited to 'commands/list.go')
-rw-r--r--commands/list.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/commands/list.go b/commands/list.go
index 870370f71..3f3286f38 100644
--- a/commands/list.go
+++ b/commands/list.go
@@ -19,7 +19,6 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/hugo/hugolib"
jww "github.com/spf13/jwalterweatherman"
- "github.com/spf13/viper"
)
func init() {
@@ -50,9 +49,11 @@ var listDraftsCmd = &cobra.Command{
return err
}
- viper.Set("buildDrafts", true)
+ c := newCommandeer(cfg)
- sites, err := hugolib.NewHugoSitesFromConfiguration(cfg)
+ c.Set("buildDrafts", true)
+
+ sites, err := hugolib.NewHugoSites(*cfg)
if err != nil {
return newSystemError("Error creating sites", err)
@@ -86,9 +87,11 @@ posted in the future.`,
return err
}
- viper.Set("buildFuture", true)
+ c := newCommandeer(cfg)
+
+ c.Set("buildFuture", true)
- sites, err := hugolib.NewHugoSitesFromConfiguration(cfg)
+ sites, err := hugolib.NewHugoSites(*cfg)
if err != nil {
return newSystemError("Error creating sites", err)
@@ -122,9 +125,11 @@ expired.`,
return err
}
- viper.Set("buildExpired", true)
+ c := newCommandeer(cfg)
+
+ c.Set("buildExpired", true)
- sites, err := hugolib.NewHugoSitesFromConfiguration(cfg)
+ sites, err := hugolib.NewHugoSites(*cfg)
if err != nil {
return newSystemError("Error creating sites", err)