(mountStr: string)
| 452 | |
| 453 | // Convert a --mount string (e.g., "type=bind,source=/a,target=/b,consistency=cached") to -v syntax for wslc. |
| 454 | function convertMountToVolume(mountStr: string): string[] { |
| 455 | const parts = new Map(mountStr.split(',').map(p => { |
| 456 | const eq = p.indexOf('='); |
| 457 | return eq === -1 ? [p, ''] : [p.substring(0, eq), p.substring(eq + 1)]; |
| 458 | })); |
| 459 | const source = parts.get('source') || parts.get('src') || ''; |
| 460 | const target = parts.get('target') || parts.get('dst') || parts.get('destination') || ''; |
| 461 | if (source && target) { |
| 462 | return ['-v', `${source}:${target}`]; |
| 463 | } |
| 464 | if (target) { |
| 465 | return ['-v', target]; |
| 466 | } |
| 467 | // Fallback: pass as --mount and let the runtime handle it. |
| 468 | return ['--mount', mountStr]; |
| 469 | } |
| 470 | |
| 471 | // Convert --mount args array (e.g., ['--mount', 'type=bind,...']) to -v syntax for wslc. |
| 472 | function convertMountArgsToVolume(args: string[]): string[] { |
no outgoing calls
no test coverage detected