Rename 'new' command to 'from'
This commit is contained in:
parent
9f1538fed4
commit
90bb429734
|
@ -4,6 +4,6 @@ import "github.com/urfave/cli/v2"
|
||||||
|
|
||||||
func All() []*cli.Command {
|
func All() []*cli.Command {
|
||||||
return []*cli.Command{
|
return []*cli.Command{
|
||||||
newProjectCommand(),
|
fromCommand(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,9 @@ import (
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newProjectCommand() *cli.Command {
|
func fromCommand() *cli.Command {
|
||||||
return &cli.Command{
|
return &cli.Command{
|
||||||
Name: "new",
|
Name: "from",
|
||||||
Aliases: []string{"n"},
|
Aliases: []string{"n"},
|
||||||
Usage: "generate a new project from a given template url",
|
Usage: "generate a new project from a given template url",
|
||||||
ArgsUsage: "<URL>",
|
ArgsUsage: "<URL>",
|
||||||
|
@ -33,11 +33,11 @@ func newProjectCommand() *cli.Command {
|
||||||
Value: "scaffold.yml",
|
Value: "scaffold.yml",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: newProjectAction,
|
Action: fromAction,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newProjectAction(c *cli.Context) error {
|
func fromAction(c *cli.Context) error {
|
||||||
rawURL := c.Args().First()
|
rawURL := c.Args().First()
|
||||||
|
|
||||||
projectURL, err := url.Parse(rawURL)
|
projectURL, err := url.Parse(rawURL)
|
||||||
|
@ -59,6 +59,10 @@ func newProjectAction(c *cli.Context) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fetcher == nil {
|
||||||
|
return errors.Errorf("could not find any fetcher matching URL '%v'", projectURL)
|
||||||
|
}
|
||||||
|
|
||||||
vfs, err := fetcher.Fetch(projectURL)
|
vfs, err := fetcher.Fetch(projectURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "could not fetch project")
|
return errors.Wrap(err, "could not fetch project")
|
Loading…
Reference in New Issue