-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathcmd_status.go
38 lines (33 loc) · 1.04 KB
/
cmd_status.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
package main
import (
"fmt"
"github.com/urfave/cli"
)
var statusCommand = cli.Command{
Name: "status",
Usage: "print the virtual machine's status",
Description: "fetch and print the configuration and status of the virtual machine",
Action: func(ctx *cli.Context) error {
status, err := statusRequest()
if err != nil {
return err
}
if status.Started {
fmt.Println("vm_state: started")
fmt.Printf("ip_address: %s\n", status.IP)
fmt.Printf("pid: %d\n", status.Pid)
} else {
fmt.Println("vm_state: stopped")
}
fmt.Printf("id: %s\n", status.Id)
fmt.Printf("hostname: %s\n", status.Hostname)
fmt.Printf("disk_size: %d\n", status.Disk)
fmt.Printf("disk_path: %s\n", status.DiskPath)
fmt.Printf("cpu_cores: %d\n", status.Cpu)
fmt.Printf("memory: %d\n", status.Memory)
fmt.Printf("dns_server: %s\n", status.DNS)
fmt.Printf("docker_version: %s\n", status.Docker)
fmt.Printf("docker_args: %s\n", status.Extra)
return nil
},
}