-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmain.go
59 lines (47 loc) · 1011 Bytes
/
main.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"fmt"
"os"
"github.com/codegangsta/cli"
"github.com/gunjan5/container-from-scratch/cmd"
)
func main() {
app := makeCmd()
if len(os.Args) > 0 {
app.Run(os.Args)
}
}
func makeCmd() *cli.App {
app := cli.NewApp()
app.Name = "CFS"
app.Usage = "sudo ./cfs <action_command> <OS_image> <command_to_run_inside_the_container>"
app.Version = "0.0.2"
fmt.Println(os.Args)
app.Commands = []cli.Command{
{
Name: "server",
ShortName: "s",
Description: "Start the REST server for CFS",
Action: cmd.Serve,
},
{
Name: "run",
ShortName: "r",
Description: "run a container with a task",
Action: cmd.Run,
},
{
Name: "newroot",
ShortName: "n",
Description: "Chroot. Not meant for direct usage",
Action: cmd.NewRoot,
},
{
Name: "child",
ShortName: "c",
Description: "child process called by run, not meant for direct usage",
Action: cmd.Child,
},
}
return app
}