github.com/containers/podman/v4@v4.9.4/pkg/machine/e2e/config_list_test.go (about)

     1  package e2e_test
     2  
     3  type listMachine struct {
     4  	/*
     5  		--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")
     6  		--noheading       Do not print headers
     7  		-q, --quiet           Show only machine names
     8  	*/
     9  
    10  	format    string
    11  	noHeading bool
    12  	quiet     bool
    13  
    14  	cmd []string
    15  }
    16  
    17  func (i *listMachine) buildCmd(m *machineTestBuilder) []string {
    18  	cmd := []string{"machine", "list"}
    19  	if len(i.format) > 0 {
    20  		cmd = append(cmd, "--format", i.format)
    21  	}
    22  	if i.noHeading {
    23  		cmd = append(cmd, "--noheading")
    24  	}
    25  	if i.quiet {
    26  		cmd = append(cmd, "--quiet")
    27  	}
    28  	i.cmd = cmd
    29  	return cmd
    30  }
    31  
    32  func (i *listMachine) withNoHeading() *listMachine {
    33  	i.noHeading = true
    34  	return i
    35  }
    36  
    37  func (i *listMachine) withQuiet() *listMachine {
    38  	i.quiet = true
    39  	return i
    40  }
    41  
    42  func (i *listMachine) withFormat(format string) *listMachine {
    43  	i.format = format
    44  	return i
    45  }