mirror of
https://code.dumpstack.io/tools/appvm.git
synced 2024-11-26 22:23:01 +00:00
Add available vm's to 'appvm list'
This commit is contained in:
parent
c7aeca1f6e
commit
c9a8a534f2
17
appvm.go
17
appvm.go
@ -9,6 +9,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
@ -98,10 +99,22 @@ func list(l *libvirt.Libvirt) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// TODO list available to create VM's too
|
||||
fmt.Println("Started VM:")
|
||||
for _, d := range domains {
|
||||
if d.Name[0:5] == "appvm" {
|
||||
fmt.Println(d.Name[6:])
|
||||
fmt.Println("\t", d.Name[6:])
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("\nAvailable VM:")
|
||||
files, err := ioutil.ReadDir(os.Getenv("GOPATH") + "/src/github.com/jollheef/appvm/nix")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
for _, f := range files {
|
||||
if f.Name() != "base.nix" && f.Name() != "local.nix" && f.Name() != "monitor.nix" {
|
||||
fmt.Println("\t", f.Name()[0:len(f.Name())-4])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user