Skip to content
/ hugo Public
forked from gohugoio/hugo

Commit

Permalink
commands: Enable format flag with hugo new site
Browse files Browse the repository at this point in the history
  • Loading branch information
jmooring committed Jun 24, 2023
1 parent 5b4bfc2 commit cc1456e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
15 changes: 8 additions & 7 deletions commands/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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{
Expand Down
5 changes: 2 additions & 3 deletions testscripts/commands/new.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

hugo new site -h
stdout 'Create a new site in the provided directory'
hugo new site my-yaml-site --format yml
checkfile my-yaml-site/hugo.yml
hugo new site mysite -f
stdout 'Congratulations! Your new Hugo site is created in'
cd mysite
Expand Down Expand Up @@ -45,6 +47,3 @@ draft: true
---

Dummy content.



0 comments on commit cc1456e

Please sign in to comment.