-
Notifications
You must be signed in to change notification settings - Fork 2
/
project_commands.go
45 lines (40 loc) · 998 Bytes
/
project_commands.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package stackcli
import (
"fmt"
"github.com/codegangsta/cli"
)
func ProjectCommands() []cli.Command {
return []cli.Command{
{
Name: "project",
Aliases: []string{"p"},
Usage: "Chef project tasks",
Subcommands: []cli.Command{
{
Name: "generate",
Usage: "stack project generate",
Flags: []cli.Flag{
cli.StringFlag{
Name: "directory-name",
Usage: "Directory Name to create",
},
cli.StringFlag{
Name: "project-name",
Usage: "Project Name (Your company name in lowercase eg: google)",
},
},
Action: func(c *cli.Context) {
dirName := c.String("directory-name")
projectName := c.String("project-name")
if len(projectName) <= 0 || len(dirName) <= 0 {
fmt.Println("You need to pass project-name and directory-name flags for the command to work")
return
}
project := NewProject(projectName, dirName)
project.Create()
},
},
},
},
}
}