aboutsummaryrefslogtreecommitdiffhomepage
path: root/commands/new.go
diff options
context:
space:
mode:
authorJoe Mooring <[email protected]>2023-06-24 08:45:53 -0700
committerBjørn Erik Pedersen <[email protected]>2023-06-24 20:26:54 +0200
commit019299b0b0bb60355c41ad5364b631f18e7d21ae (patch)
tree9f993e7fe66e3ad1a91ffe9e0f5bc972d5f8b24c /commands/new.go
parent23ed087c4e5cfad4b8ee9f4420b69182255043e0 (diff)
downloadhugo-019299b0b0bb60355c41ad5364b631f18e7d21ae.tar.gz
hugo-019299b0b0bb60355c41ad5364b631f18e7d21ae.zip
commands: Enable format flag with hugo new site
Fixes #11155
Diffstat (limited to 'commands/new.go')
-rw-r--r--commands/new.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/commands/new.go b/commands/new.go
index 1b2a412fd..b5c4d2152 100644
--- a/commands/new.go
+++ b/commands/new.go
@@ -47,13 +47,13 @@ func newNewCommand() *newCommand {
use: "content [path]",
short: "Create new content for your site",
long: `Create a new content file and automatically set the date and title.
- It will guess which kind of file to create based on the path provided.
-
- You can also specify the kind with ` + "`-k KIND`" + `.
-
- If archetypes are provided in your theme or site, they will be used.
-
- Ensure you run this within the root directory of your site.`,
+It will guess which kind of file to create based on the path provided.
+
+You can also specify the kind with ` + "`-k KIND`" + `.
+
+If archetypes are provided in your theme or site, they will be used.
+
+Ensure you run this within the root directory of your site.`,
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
if len(args) < 1 {
return errors.New("path needs to be provided")
@@ -150,6 +150,7 @@ Use ` + "`hugo new [contentPath]`" + ` to create new content.`,
},
withc: func(cmd *cobra.Command, r *rootCommand) {
cmd.Flags().BoolVarP(&force, "force", "f", false, "init inside non-empty directory")
+ cmd.Flags().StringVar(&format, "format", "toml", "preferred file format (toml, yaml or json)")
},
},
&simpleCommand{