Flag to set a custom project path.
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"gitea.codeblob.work/pk/hoster/internals/conf"
|
||||
"gitea.codeblob.work/pk/hoster/internals/helpers"
|
||||
@ -18,8 +19,9 @@ import (
|
||||
)
|
||||
|
||||
func CmdNew(c *cli.Context) error {
|
||||
name := c.String("name")
|
||||
domain := c.String("domain")
|
||||
name := strings.TrimSpace(c.String("name"))
|
||||
domain := strings.TrimSpace(c.String("domain"))
|
||||
customProjectPath := strings.TrimSpace(c.String("project-path"))
|
||||
projectRoot := conf.App.MustString("projects.root")
|
||||
sitesAvail := conf.App.MustString("nginx.sitesAvailable")
|
||||
sitesEnabled := conf.App.MustString("nginx.sitesEnabled")
|
||||
@ -27,6 +29,10 @@ func CmdNew(c *cli.Context) error {
|
||||
|
||||
projectFolder := filepath.Join(projectRoot, name)
|
||||
|
||||
if customProjectPath == "" {
|
||||
projectFolder = customProjectPath
|
||||
}
|
||||
|
||||
existingProjects, err := helpers.FindHostConfigs(sitesAvail)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -22,7 +22,7 @@ func Execute() {
|
||||
app := &cli.App{
|
||||
Name: "hoster",
|
||||
Usage: "Hoster",
|
||||
Version: "1.0.3",
|
||||
Version: "1.0.4",
|
||||
Commands: []*cli.Command{
|
||||
{
|
||||
Name: "new",
|
||||
@ -34,6 +34,12 @@ func Execute() {
|
||||
Usage: "The name of the project",
|
||||
Required: true,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "custom-path",
|
||||
Aliases: []string{"d"},
|
||||
Usage: "The path of the project. Defaults to ${projects.root}/${name}.",
|
||||
Required: false,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "domain",
|
||||
Aliases: []string{"d"},
|
||||
|
Reference in New Issue
Block a user