aboutsummaryrefslogtreecommitdiff
path: root/pkg/machine/e2e/config_list.go
blob: 150f984bc7bc71bb4858c051d0b8e9fbb3d1afca (plain)
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
package e2e

type listMachine struct {
	/*
		--format string   Format volume output using JSON or a Go template (default "{{.Name}}\t{{.VMType}}\t{{.Created}}\t{{.LastUp}}\t{{.CPUs}}\t{{.Memory}}\t{{.DiskSize}}\n")
		--noheading       Do not print headers
		-q, --quiet           Show only machine names
	*/

	format    string
	noHeading bool
	quiet     bool

	cmd []string
}

func (i *listMachine) buildCmd(m *machineTestBuilder) []string {
	cmd := []string{"machine", "list"}
	if len(i.format) > 0 {
		cmd = append(cmd, "--format", i.format)
	}
	if i.noHeading {
		cmd = append(cmd, "--noheading")
	}
	if i.quiet {
		cmd = append(cmd, "--quiet")
	}
	i.cmd = cmd
	return cmd
}

func (i *listMachine) withNoHeading() *listMachine {
	i.noHeading = true
	return i
}

func (i *listMachine) withQuiet() *listMachine {
	i.quiet = true
	return i
}

func (i *listMachine) withFormat(format string) *listMachine {
	i.format = format
	return i
}