diff options
author | Bjørn Erik Pedersen <[email protected]> | 2020-01-31 09:09:11 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2020-01-31 16:36:36 +0100 |
commit | 2bbc865f7bb713b2d0d2dbb02b90ae2621ad5367 (patch) | |
tree | cda2d88ec0079293780028d3f0fe699f839777e7 /commands/list.go | |
parent | 0792cfa9fae94a06a31e393a46fed3b1dd73b66a (diff) | |
download | hugo-2bbc865f7bb713b2d0d2dbb02b90ae2621ad5367.tar.gz hugo-2bbc865f7bb713b2d0d2dbb02b90ae2621ad5367.zip |
commands: Fix config environment handling
Fixes #6503
Fixes #6824
Diffstat (limited to 'commands/list.go')
-rw-r--r-- | commands/list.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/commands/list.go b/commands/list.go index f233ce62c..0b7c18797 100644 --- a/commands/list.go +++ b/commands/list.go @@ -29,8 +29,7 @@ import ( var _ cmder = (*listCmd)(nil) type listCmd struct { - hugoBuilderCommon - *baseCmd + *baseBuilderCmd } func (lc *listCmd) buildSites(config map[string]interface{}) (*hugolib.HugoSites, error) { @@ -59,19 +58,19 @@ func (lc *listCmd) buildSites(config map[string]interface{}) (*hugolib.HugoSites return sites, nil } -func newListCmd() *listCmd { +func (b *commandsBuilder) newListCmd() *listCmd { cc := &listCmd{} - cc.baseCmd = newBaseCmd(&cobra.Command{ + cmd := &cobra.Command{ Use: "list", Short: "Listing out various types of content", Long: `Listing out various types of content. List requires a subcommand, e.g. ` + "`hugo list drafts`.", RunE: nil, - }) + } - cc.cmd.AddCommand( + cmd.AddCommand( &cobra.Command{ Use: "drafts", Short: "List all drafts", @@ -202,8 +201,7 @@ List requires a subcommand, e.g. ` + "`hugo list drafts`.", }, ) - cc.cmd.PersistentFlags().StringVarP(&cc.source, "source", "s", "", "filesystem path to read files relative from") - cc.cmd.PersistentFlags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{}) + cc.baseBuilderCmd = b.newBuilderBasicCmd(cmd) return cc } |