diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-05-22 19:00:07 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-05-22 20:26:02 +0200 |
commit | 85b13c105a202baf80796a5eab144d3f74a4cc42 (patch) | |
tree | fafb1ef74dc7b1e03979bb180843c5fa2b3abf1c /commands/new.go | |
parent | b6e6438f7f742cada5126aa59e856f8531dc6420 (diff) |
Add --format to hugo config
Now default to TOML.
Diffstat (limited to 'commands/new.go')
-rw-r--r-- | commands/new.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/commands/new.go b/commands/new.go index 5a940a1cd..c3ba09162 100644 --- a/commands/new.go +++ b/commands/new.go @@ -34,9 +34,8 @@ import ( func newNewCommand() *newCommand { var ( - configFormat string - force bool - contentType string + force bool + contentType string ) var c *newCommand @@ -119,7 +118,7 @@ Use ` + "`hugo new [contentPath]`" + ` to create new content.`, return errors.New(createpath + " already exists and is not empty. See --force.") case !isEmpty && force: - all := append(dirs, filepath.Join(createpath, "hugo."+configFormat)) + all := append(dirs, filepath.Join(createpath, "hugo."+r.format)) for _, path := range all { if exists, _ := helpers.Exists(path, sourceFs); exists { return errors.New(path + " already exists") @@ -134,7 +133,7 @@ Use ` + "`hugo new [contentPath]`" + ` to create new content.`, } } - c.newSiteCreateConfig(sourceFs, createpath, configFormat) + c.newSiteCreateConfig(sourceFs, createpath, r.format) // Create a default archetype file. helpers.SafeWriteToDisk(filepath.Join(archeTypePath, "default.md"), @@ -146,7 +145,6 @@ Use ` + "`hugo new [contentPath]`" + ` to create new content.`, return nil }, withc: func(cmd *cobra.Command) { - cmd.Flags().StringVarP(&configFormat, "format", "f", "toml", "config file format") cmd.Flags().BoolVar(&force, "force", false, "init inside non-empty directory") }, }, |