дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 03:05:40 +02:00
Initial open-source release
Claude-Session: https://claude.ai/code/session_01B65qLEKnkeYTGdbwhLpjCu
Цей коміт міститься в:
коміт
9a2025b76e
2034 files changed
+243381
No files matched your search
@@ -0,0 +1,29 @@
|
||||
/** Command-line helpers shared by the terminal and External Tools. */
|
||||
|
||||
/** Splits a command line (`/bin/zsh --login`, `-c "a b"`) into words, honouring quotes. */
|
||||
export function splitCommandLine(line: string): string[] {
|
||||
const out: string[] = [];
|
||||
let cur = "";
|
||||
let quote: string | null = null;
|
||||
let has = false;
|
||||
for (let i = 0; i < line.length; i++) {
|
||||
const c = line[i]!;
|
||||
if (quote) {
|
||||
if (c === quote) quote = null;
|
||||
else if (c === "\\" && quote === '"' && i + 1 < line.length) cur += line[++i];
|
||||
else cur += c;
|
||||
} else if (c === '"' || c === "'") {
|
||||
quote = c;
|
||||
has = true;
|
||||
} else if (c === "\\" && i + 1 < line.length) {
|
||||
cur += line[++i];
|
||||
has = true;
|
||||
} else if (/\s/.test(c)) {
|
||||
if (has || cur) out.push(cur);
|
||||
cur = "";
|
||||
has = false;
|
||||
} else cur += c;
|
||||
}
|
||||
if (has || cur) out.push(cur);
|
||||
return out;
|
||||
}
|
||||
Reference in new issue
Заблокувати користувача