Repository: gohugoio/hugo (language: go)

Issue:
hugo new theme creates resources directory in pwd
`hugo new theme` creates a resources directory in the current directory.


If we can fix this, after https://github.com/gohugoio/hugo/pull/11381 is merged, you will be able to _cleanly_ do:

```
hugo new theme my-new-site --themesDir .
cd my-new-site/
hugo server
```





Discussion / hints:
`hugo new content` in an empty directory does this too.

Fix patch:
diff --git a/commands/new.go b/commands/new.go
index 3f43a687f47..ffd75b2bbb4 100644
--- a/commands/new.go
+++ b/commands/new.go
@@ -20,6 +20,7 @@ import (
 	"strings"
 
 	"github.com/bep/simplecobra"
+	"github.com/gohugoio/hugo/common/paths"
 	"github.com/gohugoio/hugo/config"
 	"github.com/gohugoio/hugo/create"
 	"github.com/gohugoio/hugo/create/skeletons"
@@ -120,14 +121,15 @@ according to your needs.`,
 					if len(args) < 1 {
 						return newUserError("theme name needs to be provided")
 					}
-					h, err := r.Hugo(flagsToCfg(cd, nil))
+					cfg := config.New()
+					cfg.Set("publishDir", "public")
+
+					conf, err := r.ConfigFromProvider(r.configVersionID.Load(), flagsToCfg(cd, cfg))
 					if err != nil {
 						return err
 					}
-					ps := h.PathSpec
-					sourceFs := ps.Fs.Source
-					themesDir := h.Configs.LoadingInfo.BaseConfig.ThemesDir
-					createpath := ps.AbsPathify(filepath.Join(themesDir, args[0]))
+					sourceFs := conf.fs.Source
+					createpath := paths.AbsPathify(conf.configs.Base.WorkingDir, filepath.Join(conf.configs.Base.ThemesDir, args[0]))
 					r.Println("Creating new theme in", createpath)
 
 					err = skeletons.CreateTheme(createpath, sourceFs)


Test patch:
diff --git a/testscripts/unfinished/noop.txt b/testscripts/commands/noop.txt
similarity index 100%
rename from testscripts/unfinished/noop.txt
rename to testscripts/commands/noop.txt
diff --git a/testscripts/commands/new.txt b/testscripts/unfinished/new.txt
similarity index 98%
rename from testscripts/commands/new.txt
rename to testscripts/unfinished/new.txt
index f44aaca2028..4ac264eb175 100644
--- a/testscripts/commands/new.txt
+++ b/testscripts/unfinished/new.txt
@@ -16,11 +16,13 @@ exists i18n
 exists layouts
 exists static
 exists themes
+! exists resources
 
 hugo new theme -h
 stdout 'Create a new theme \(skeleton\) called \[name\] in ./themes'
 hugo new theme mytheme
 stdout 'Creating new theme'
+! exists resources
 cd themes
 cd mytheme
 checkfile archetypes/default.md