-
Notifications
You must be signed in to change notification settings - Fork 1
/
save.go
53 lines (45 loc) · 820 Bytes
/
save.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
package main
import (
"fmt"
"github.com/urfave/cli/v2"
)
func save(c *cli.Context) error {
l := c.NArg()
var volume string
tarName := "data"
path := "./"
if l == 0 {
return e1("need at least 1 arguments")
}
if l > 0 {
volume = c.Args().Get(0)
}
if l > 1 {
tarName = c.Args().Get(1)
}
if l > 2 {
path = c.Args().Get(2)
}
n.Save(volume, tarName, path)
return nil
}
func saveComplete(c *cli.Context) {
// This will complete if no args are passed
if c.NArg() == 1 {
fmt.Println("data")
}
if c.NArg() == 2 {
fmt.Println("./")
}
if c.NArg() == 0 {
ls := n.Cmd.Create("docker", "volume", "ls", "-q")
volumes := make([]string, 0, 10)
ls.CustomRun(func(s string) {
volumes = append(volumes, s)
}, func(s string) {
})
for _, t := range volumes {
fmt.Println(t)
}
}
}