diff options
author | satotake <doublequotation@gmail.com> | 2022-09-01 00:23:31 +0900 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-09-08 15:35:11 +0200 |
commit | 7d40da876c62a166bdd273209b7cd6bead9266c1 (patch) | |
tree | f4a0aa6c7f45cbfc4181bcff8586db98a580be53 /commands/new.go | |
parent | 02c89a446d1a76491bfb4b9a756d892a83584d17 (diff) |
Add `--force` to `hugo new`
Closes #9243
Diffstat (limited to 'commands/new.go')
-rw-r--r-- | commands/new.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/commands/new.go b/commands/new.go index c5b5cd182..bf626a6a5 100644 --- a/commands/new.go +++ b/commands/new.go @@ -32,6 +32,7 @@ var _ cmder = (*newCmd)(nil) type newCmd struct { contentEditor string contentType string + force bool *baseBuilderCmd } @@ -54,6 +55,7 @@ Ensure you run this within the root directory of your site.`, cmd.Flags().StringVarP(&cc.contentType, "kind", "k", "", "content type to create") cmd.Flags().StringVar(&cc.contentEditor, "editor", "", "edit new content with this editor, if provided") + cmd.Flags().BoolVarP(&cc.force, "force", "f", false, "allow to override file") cmd.AddCommand(b.newNewSiteCmd().getCommand()) cmd.AddCommand(b.newNewThemeCmd().getCommand()) @@ -80,7 +82,7 @@ func (n *newCmd) newContent(cmd *cobra.Command, args []string) error { return newUserError("path needs to be provided") } - return create.NewContent(c.hugo(), n.contentType, args[0]) + return create.NewContent(c.hugo(), n.contentType, args[0], n.force) } func mkdir(x ...string) { |