-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
61 lines (55 loc) · 1.13 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
package main
import (
"fmt"
"log"
"os"
"time"
run "github.com/iwilltry42/k3d-tools/cli"
"github.com/iwilltry42/k3d-tools/version"
"github.com/urfave/cli"
)
// main represents the CLI application
func main() {
// App Details
app := cli.NewApp()
app.Name = "k3d-tools"
app.Usage = "Tools to help running k3d successfully!"
app.Version = version.GetVersion()
// commands that you can execute
app.Commands = []cli.Command{
{
// save-image
Name: "save-image",
Aliases: []string{"save"},
Usage: "Save images to tarball",
Flags: []cli.Flag{
cli.StringFlag{
Name: "destination, dest, d",
Value: "/images",
Usage: "destination tar-file (optional)",
},
cli.StringFlag{
Name: "cluster, c",
Value: "k3s-default",
Usage: "name of the k3d cluster",
},
},
Action: run.ImageSave,
},
{
Name: "noop",
Usage: "Don't do anything and sleep forever",
Action: func(c *cli.Context) {
for {
fmt.Println("Sleeping for 12h")
time.Sleep(12 * time.Hour)
}
},
},
}
// run the whole thing
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}