-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.go
67 lines (59 loc) · 1.46 KB
/
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
60
61
62
63
64
65
66
67
package main
import (
"fmt"
"os"
"path"
"./commands"
"github.com/codegangsta/cli"
)
func main() {
arg_num := len(os.Args)
// If the command parameter number indeed smaller than 2 ??
if arg_num <= 1 {
fmt.Errorf("The num of input args is %s, too short.\n", arg_num-1)
return
}
app := cli.NewApp()
app.Name = path.Base(os.Args[0])
app.Author = "Allen Sun"
app.Email = " [email protected] "
app.Commands = []cli.Command{
{
Name: "dup",
Usage: "Duplicate a container's data volumes to another one.",
Description: "FORMAT : volrep dup srcCon destCon.",
Flags: []cli.Flag{
flDockerRoot,
},
Action: commands.CmdDup,
},
{
Name: "save",
Usage: "Save a container's data volumes as compressed volumes.",
Description: "FORMAT: volrep save containerA.",
Action: commands.CmdSave,
},
{
Name: "load",
Usage: "Load a container's data volumes from sepcified container's compressed volumes.",
Description: "FORMAT: volrep load srcCon destCon.",
Action: commands.CmdLoad,
},
{
Name: "list",
Usage: "List a container's all compressed volume.",
Description: "FORMAT: volrep list srcCon.",
Action: commands.CmdList,
},
{
Name: "rm",
Usage: "Remove a container's compressed volume.",
Description: "FORMAT: volrep rm srcCon.",
Flags: []cli.Flag{
flRemoveAll,
},
Action: commands.CmdRm,
},
}
app.Run(os.Args)
}