diff options
| author | Jeff Carr <[email protected]> | 2024-10-26 10:34:04 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-26 10:34:04 -0500 |
| commit | 783a06b050048e22aac9fcc1520ca43c40226f14 (patch) | |
| tree | 64189bd86ea7f8cc68e327099e0c34543c15a27c /main.go | |
| parent | ca0d7ddde751a2d582a03f0ad70cec4c8c767145 (diff) | |
can write out working virsh xml
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 36 |
1 files changed, 34 insertions, 2 deletions
@@ -16,11 +16,15 @@ package main import ( "embed" - "flag" "net" + "os" + "path/filepath" "time" "github.com/digitalocean/go-qemu/hypervisor" + "go.wit.com/dev/alexflint/arg" + pb "go.wit.com/lib/protobuf/virtbuf" + "go.wit.com/log" ) var Version string @@ -31,7 +35,35 @@ var resources embed.FS var hv *hypervisor.Hypervisor func main() { - flag.Parse() + if os.Getenv("VIRTIGO_HOME") == "" { + homeDir, _ := os.UserHomeDir() + fullpath := filepath.Join(homeDir, ".config/virtigo") + os.Setenv("VIRTIGO_HOME", fullpath) + } + var pp *arg.Parser + pp = arg.MustParse(&argv) + + if pp == nil { + pp.WriteHelp(os.Stdout) + os.Exit(0) + } + + me.cluster = new(pb.Cluster) + if err := me.cluster.ConfigLoad(); err != nil { + log.Info("config file error:", err) + os.Exit(0) + } + + for i, e := range me.cluster.Events { + log.Info("Event", i, e) + } + + if argv.Start != "" { + newStart(argv.Start) + os.Exit(0) + } + + log.DaemonMode(true) // fmt.Printf("\nConnecting to %s://%s\n", *network, *address) newConn := func() (net.Conn, error) { |
