mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user