diff options
Diffstat (limited to 'commands/list.go')
-rw-r--r-- | commands/list.go | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/commands/list.go b/commands/list.go index b2a6b5395..b391f204e 100644 --- a/commands/list.go +++ b/commands/list.go @@ -43,20 +43,16 @@ var listDraftsCmd = &cobra.Command{ Short: "List all drafts", Long: `List all of the drafts in your content directory.`, RunE: func(cmd *cobra.Command, args []string) error { - - cfg, err := InitializeConfig() - if err != nil { - return err + cfgInit := func(c *commandeer) error { + c.Set("buildDrafts", true) + return nil } - - c, err := newCommandeer(cfg) + c, err := InitializeConfig(false, cfgInit) if err != nil { return err } - c.Set("buildDrafts", true) - - sites, err := hugolib.NewHugoSites(*cfg) + sites, err := hugolib.NewHugoSites(*c.DepsCfg) if err != nil { return newSystemError("Error creating sites", err) @@ -84,20 +80,16 @@ var listFutureCmd = &cobra.Command{ Long: `List all of the posts in your content directory which will be posted in the future.`, RunE: func(cmd *cobra.Command, args []string) error { - - cfg, err := InitializeConfig() - if err != nil { - return err + cfgInit := func(c *commandeer) error { + c.Set("buildFuture", true) + return nil } - - c, err := newCommandeer(cfg) + c, err := InitializeConfig(false, cfgInit) if err != nil { return err } - c.Set("buildFuture", true) - - sites, err := hugolib.NewHugoSites(*cfg) + sites, err := hugolib.NewHugoSites(*c.DepsCfg) if err != nil { return newSystemError("Error creating sites", err) @@ -125,20 +117,16 @@ var listExpiredCmd = &cobra.Command{ Long: `List all of the posts in your content directory which has already expired.`, RunE: func(cmd *cobra.Command, args []string) error { - - cfg, err := InitializeConfig() - if err != nil { - return err + cfgInit := func(c *commandeer) error { + c.Set("buildExpired", true) + return nil } - - c, err := newCommandeer(cfg) + c, err := InitializeConfig(false, cfgInit) if err != nil { return err } - c.Set("buildExpired", true) - - sites, err := hugolib.NewHugoSites(*cfg) + sites, err := hugolib.NewHugoSites(*c.DepsCfg) if err != nil { return newSystemError("Error creating sites", err) |