diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-04-10 09:19:26 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-04-11 09:50:19 +0200 |
commit | 4d32f2fa8969f368b088dc9bcedb45f2c986cb27 (patch) | |
tree | a091c49f6011605f08b92b9dbdb2d2acdd87f9ce /commands/new.go | |
parent | 018602c46db8d729af2871bd5f4c1e7480420f09 (diff) |
commands: Make the hugo command non-global
See #4598
Diffstat (limited to 'commands/new.go')
-rw-r--r-- | commands/new.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/commands/new.go b/commands/new.go index f4caff50c..2fb35a9a3 100644 --- a/commands/new.go +++ b/commands/new.go @@ -33,15 +33,11 @@ type newCmd struct { contentEditor string contentType string - cmd *cobra.Command -} - -func (c *newCmd) getCommand() *cobra.Command { - return c.cmd + *baseCmd } func newNewCmd() *newCmd { - ccmd := &newCmd{} + ccmd := &newCmd{baseCmd: newBaseCmd(nil)} cmd := &cobra.Command{ Use: "new [path]", Short: "Create new content for your site", @@ -57,7 +53,7 @@ If archetypes are provided in your theme or site, they will be used.`, cmd.Flags().StringVarP(&ccmd.contentType, "kind", "k", "", "content type to create") // TODO(bep) cli refactor - cmd.PersistentFlags().StringVarP(&source, "source", "s", "", "filesystem path to read files relative from") + // cmd.PersistentFlags().StringVarP(&source, "source", "s", "", "filesystem path to read files relative from") cmd.PersistentFlags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{}) cmd.Flags().StringVar(&ccmd.contentEditor, "editor", "", "edit new content with this editor, if provided") @@ -77,7 +73,7 @@ func (n *newCmd) newContent(cmd *cobra.Command, args []string) error { return nil } - c, err := InitializeConfig(false, cfgInit) + c, err := initializeConfig(false, nil, n, cfgInit) if err != nil { return err |