MCPcopy Index your code
hub / github.com/codeaashu/claude-code / tryParseShellCommand

Function tryParseShellCommand

src/utils/bash/shellQuote.ts:24–45  ·  view source on GitHub ↗
(
  cmd: string,
  env?:
    | Record<string, string | undefined>
    | ((key: string) => string | undefined),
)

Source from the content-addressed store, hash-verified

22 | { success: false; error: string }
23
24export function tryParseShellCommand(
25 cmd: string,
26 env?:
27 | Record<string, string | undefined>
28 | ((key: string) => string | undefined),
29): ShellParseResult {
30 try {
31 const tokens =
32 typeof env === 'function'
33 ? shellQuoteParse(cmd, env)
34 : shellQuoteParse(cmd, env)
35 return { success: true, tokens }
36 } catch (error) {
37 if (error instanceof Error) {
38 logError(error)
39 }
40 return {
41 success: false,
42 error: error instanceof Error ? error.message : 'Unknown parse error',
43 }
44 }
45}
46
47export function tryQuoteShellArgs(args: unknown[]): ShellQuoteResult {
48 try {

Callers 15

isLinePrintingCommandFunction · 0.85
isSubstitutionCommandFunction · 0.85
hasFileArgsFunction · 0.85
extractSedExpressionsFunction · 0.85
bashToolHasPermissionFunction · 0.85
isNormalizedGitCommandFunction · 0.85
isNormalizedCdCommandFunction · 0.85
checkReadOnlyConstraintsFunction · 0.85
parseCommandArgumentsFunction · 0.85

Calls 1

logErrorFunction · 0.50

Tested by

no test coverage detected