MCPcopy Index your code
hub / github.com/coder/mux / getExecutableFromShellCommand

Function getExecutableFromShellCommand

src/node/services/editorService.ts:26–40  ·  view source on GitHub ↗
(command: string)

Source from the content-addressed store, hash-verified

24}
25
26function getExecutableFromShellCommand(command: string): string | null {
27 const trimmed = command.trim();
28 if (!trimmed) return null;
29
30 const quote = trimmed[0];
31 if (quote === '"' || quote === "'") {
32 const endQuoteIndex = trimmed.indexOf(quote, 1);
33 if (endQuoteIndex === -1) {
34 return null;
35 }
36 return trimmed.slice(1, endQuoteIndex);
37 }
38
39 return trimmed.split(/\s+/)[0] ?? null;
40}
41
42function looksLikePath(command: string): boolean {
43 return (

Callers 1

openInEditorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected