commandLine is the ghmock run command for these options, quoted for a POSIX shell.
()
| 228 | // commandLine is the ghmock run command for these options, quoted for a |
| 229 | // POSIX shell. |
| 230 | func (o runOptions) commandLine() string { |
| 231 | parts := []string{"ghmock", "run"} |
| 232 | for _, b := range o.binaries { |
| 233 | parts = append(parts, "--gh", shellQuote(b)) |
| 234 | } |
| 235 | if o.tty { |
| 236 | parts = append(parts, "--tty") |
| 237 | } |
| 238 | if o.terminal && len(o.keys) == 0 { |
| 239 | parts = append(parts, "--terminal") |
| 240 | } |
| 241 | for _, k := range o.keys { |
| 242 | parts = append(parts, "--keys", shellQuote(k)) |
| 243 | } |
| 244 | if o.stdin != "" { |
| 245 | parts = append(parts, "--stdin", shellQuote(o.stdin)) |
| 246 | } |
| 247 | if o.loggedOut { |
| 248 | parts = append(parts, "--logged-out") |
| 249 | } |
| 250 | if o.localhost { |
| 251 | parts = append(parts, "--localhost") |
| 252 | } |
| 253 | if o.configDir != "" { |
| 254 | parts = append(parts, "--config-dir", shellQuote(o.configDir)) |
| 255 | } |
| 256 | if o.in != "" { |
| 257 | parts = append(parts, "--in", shellQuote(o.in)) |
| 258 | } |
| 259 | if o.timeout != defaultTimeout { |
| 260 | parts = append(parts, "--timeout", o.timeout.String()) |
| 261 | } |
| 262 | parts = append(parts, "--") |
| 263 | for _, a := range o.args { |
| 264 | parts = append(parts, shellQuote(a)) |
| 265 | } |
| 266 | return strings.Join(parts, " ") |
| 267 | } |
| 268 | |
| 269 | var shellSafe = regexp.MustCompile(`^[A-Za-z0-9_@%+=:,./-]+$`) |
| 270 |
no test coverage detected