all: Refactor to non-global logger

Note that this looks like overkill for just the logger, and that is correct,
but this will make sense once we start with the template handling etc.

Updates #2701
This commit is contained in:
Bjørn Erik Pedersen
2017-01-03 17:28:51 +01:00
parent 24a286791f
commit 45e3ed517a
42 changed files with 410 additions and 320 deletions

View File

@@ -45,13 +45,14 @@ var listDraftsCmd = &cobra.Command{
Long: `List all of the drafts in your content directory.`,
RunE: func(cmd *cobra.Command, args []string) error {
if err := InitializeConfig(); err != nil {
cfg, err := InitializeConfig()
if err != nil {
return err
}
viper.Set("buildDrafts", true)
sites, err := hugolib.NewHugoSitesFromConfiguration()
sites, err := hugolib.NewHugoSitesFromConfiguration(cfg)
if err != nil {
return newSystemError("Error creating sites", err)
@@ -80,13 +81,14 @@ var listFutureCmd = &cobra.Command{
posted in the future.`,
RunE: func(cmd *cobra.Command, args []string) error {
if err := InitializeConfig(); err != nil {
cfg, err := InitializeConfig()
if err != nil {
return err
}
viper.Set("buildFuture", true)
sites, err := hugolib.NewHugoSitesFromConfiguration()
sites, err := hugolib.NewHugoSitesFromConfiguration(cfg)
if err != nil {
return newSystemError("Error creating sites", err)
@@ -115,13 +117,14 @@ var listExpiredCmd = &cobra.Command{
expired.`,
RunE: func(cmd *cobra.Command, args []string) error {
if err := InitializeConfig(); err != nil {
cfg, err := InitializeConfig()
if err != nil {
return err
}
viper.Set("buildExpired", true)
sites, err := hugolib.NewHugoSitesFromConfiguration()
sites, err := hugolib.NewHugoSitesFromConfiguration(cfg)
if err != nil {
return newSystemError("Error creating sites", err)