MCPcopy Create free account
hub / github.com/cli/cli / shellQuote

Function shellQuote

script/ghmock/run.go:271–276  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

269var shellSafe = regexp.MustCompile(`^[A-Za-z0-9_@%+=:,./-]+$`)
270
271func shellQuote(s string) string {
272 if shellSafe.MatchString(s) {
273 return s
274 }
275 return "'" + strings.ReplaceAll(s, "'", `'\''`) + "'"
276}
277
278// runBinary runs one gh binary in its own scratch folder. With ca, gh uses
279// github.com and trusts only ca; without it, gh uses github.localhost.

Callers 4

TestCmdGitFunction · 0.70
commandLineMethod · 0.70
gitEnvironmentFunction · 0.70
printReportFunction · 0.70

Calls

no outgoing calls

Tested by 1

TestCmdGitFunction · 0.56