MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / containsMultilineString

Function containsMultilineString

src/utils/bash/shellQuoting.ts:27–38  ·  view source on GitHub ↗

* Detects if a command contains multiline strings in quotes

(command: string)

Source from the content-addressed store, hash-verified

25 * Detects if a command contains multiline strings in quotes
26 */
27function containsMultilineString(command: string): boolean {
28 // Check for strings with actual newlines in them
29 // Handle escaped quotes by using a more sophisticated pattern
30 // Match single quotes: '...\n...' where content can include escaped quotes \'
31 // Match double quotes: "...\n..." where content can include escaped quotes \"
32 const singleQuoteMultiline = /'(?:[^'\\]|\\.)*\n(?:[^'\\]|\\.)*'/
33 const doubleQuoteMultiline = /"(?:[^"\\]|\\.)*\n(?:[^"\\]|\\.)*"/
34
35 return (
36 singleQuoteMultiline.test(command) || doubleQuoteMultiline.test(command)
37 )
38}
39
40/**
41 * Quotes a shell command appropriately, preserving heredocs and multiline strings

Callers 1

quoteShellCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected