(input: string)
| 12 | * input returns `undefined` so callers can clear the override. |
| 13 | */ |
| 14 | export async function expandTilde(input: string): Promise<string | undefined> { |
| 15 | const trimmed = input.trim(); |
| 16 | if (!trimmed) { |
| 17 | return undefined; |
| 18 | } |
| 19 | if (trimmed === "~") { |
| 20 | return homeDir(); |
| 21 | } |
| 22 | if (trimmed.startsWith("~/")) { |
| 23 | const home = await homeDir(); |
| 24 | const base = home.endsWith("/") ? home.slice(0, -1) : home; |
| 25 | return `${base}/${trimmed.slice(2)}`; |
| 26 | } |
| 27 | return trimmed; |
| 28 | } |
| 29 | |
| 30 | export function loadWorkspaces(): Workspace[] { |
| 31 | try { |
no outgoing calls
no test coverage detected