MCPcopy Create free account
hub / github.com/ddev/ddev / CanRunWithoutDocker

Function CanRunWithoutDocker

pkg/dockerutil/requirements.go:123–142  ·  view source on GitHub ↗

CanRunWithoutDocker returns true if the command or flag can run without Docker.

()

Source from the content-addressed store, hash-verified

121
122// CanRunWithoutDocker returns true if the command or flag can run without Docker.
123func CanRunWithoutDocker() bool {
124 if len(os.Args) < 2 {
125 return true
126 }
127 // Some commands don't support Cobra help, because they are wrappers
128 if slices.Contains([]string{"composer"}, os.Args[1]) {
129 return false
130 }
131 if output.ParseBoolFlag("version", "v") || output.ParseBoolFlag("help", "h") {
132 return true
133 }
134 if len(os.Args) == 2 && output.ParseBoolFlag("json-output", "j") {
135 return true
136 }
137 // help and hostname should not require docker
138 if slices.Contains([]string{"help", "hostname"}, os.Args[1]) {
139 return true
140 }
141 return false
142}
143
144// CheckAvailableSpace outputs a warning if Docker space is low
145func CheckAvailableSpace() {

Callers 1

initFunction · 0.92

Calls 1

ParseBoolFlagFunction · 0.92

Tested by

no test coverage detected