mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 10:22:10 -05:00
commands: Make "new theme" feedback more intuitive
This commit is contained in:
parent
d3dd74fd65
commit
692ec00872
1 changed files with 6 additions and 7 deletions
|
@ -14,16 +14,14 @@
|
||||||
package commands
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gohugoio/hugo/hugofs"
|
|
||||||
|
|
||||||
"github.com/gohugoio/hugo/helpers"
|
"github.com/gohugoio/hugo/helpers"
|
||||||
|
"github.com/gohugoio/hugo/hugofs"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
jww "github.com/spf13/jwalterweatherman"
|
jww "github.com/spf13/jwalterweatherman"
|
||||||
)
|
)
|
||||||
|
@ -53,6 +51,7 @@ as you see fit.`,
|
||||||
return ccmd
|
return ccmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// newTheme creates a new Hugo theme template
|
||||||
func (n *newThemeCmd) newTheme(cmd *cobra.Command, args []string) error {
|
func (n *newThemeCmd) newTheme(cmd *cobra.Command, args []string) error {
|
||||||
c, err := initializeConfig(false, false, &n.hugoBuilderCommon, n, nil)
|
c, err := initializeConfig(false, false, &n.hugoBuilderCommon, n, nil)
|
||||||
|
|
||||||
|
@ -65,12 +64,12 @@ func (n *newThemeCmd) newTheme(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
createpath := c.hugo.PathSpec.AbsPathify(filepath.Join(c.Cfg.GetString("themesDir"), args[0]))
|
createpath := c.hugo.PathSpec.AbsPathify(filepath.Join(c.Cfg.GetString("themesDir"), args[0]))
|
||||||
jww.INFO.Println("creating theme at", createpath)
|
jww.FEEDBACK.Println("Creating theme at", createpath)
|
||||||
|
|
||||||
cfg := c.DepsCfg
|
cfg := c.DepsCfg
|
||||||
|
|
||||||
if x, _ := helpers.Exists(createpath, cfg.Fs.Source); x {
|
if x, _ := helpers.Exists(createpath, cfg.Fs.Source); x {
|
||||||
return newUserError(createpath, "already exists")
|
return errors.New(createpath + " already exists")
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdir(createpath, "layouts", "_default")
|
mkdir(createpath, "layouts", "_default")
|
||||||
|
|
Loading…
Reference in a new issue