goctl api new should given a service_name explictly (#1688)
This commit is contained in:
@@ -20,11 +20,12 @@ var apiTemplate string
|
|||||||
|
|
||||||
// CreateServiceCommand fast create service
|
// CreateServiceCommand fast create service
|
||||||
func CreateServiceCommand(c *cli.Context) error {
|
func CreateServiceCommand(c *cli.Context) error {
|
||||||
|
if c.NArg() == 0 {
|
||||||
|
cli.ShowCommandHelpAndExit(c, "new", 1)
|
||||||
|
}
|
||||||
|
|
||||||
args := c.Args()
|
args := c.Args()
|
||||||
dirName := args.First()
|
dirName := args.First()
|
||||||
if len(dirName) == 0 {
|
|
||||||
dirName = "greet"
|
|
||||||
}
|
|
||||||
|
|
||||||
dirStyle := c.String("style")
|
dirStyle := c.String("style")
|
||||||
if len(dirStyle) == 0 {
|
if len(dirStyle) == 0 {
|
||||||
|
|||||||
@@ -137,9 +137,10 @@ var commands = []cli.Command{
|
|||||||
Action: apigen.ApiCommand,
|
Action: apigen.ApiCommand,
|
||||||
Subcommands: []cli.Command{
|
Subcommands: []cli.Command{
|
||||||
{
|
{
|
||||||
Name: "new",
|
Name: "new",
|
||||||
Usage: "fast create api service",
|
Usage: "fast create api service",
|
||||||
Action: new.CreateServiceCommand,
|
UsageText: "example: goctl api new [options] server_name",
|
||||||
|
Action: new.CreateServiceCommand,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "home",
|
Name: "home",
|
||||||
|
|||||||
Reference in New Issue
Block a user