| 97 | } |
| 98 | |
| 99 | private getPrompt(): string { |
| 100 | const cwd = this.env.getCwd(); |
| 101 | const home = this.env.getEnv().HOME || "/home/user"; |
| 102 | |
| 103 | // Replace home with ~ |
| 104 | let displayCwd = cwd; |
| 105 | if (cwd === home) { |
| 106 | displayCwd = "~"; |
| 107 | } else if (cwd.startsWith(`${home}/`)) { |
| 108 | displayCwd = `~${cwd.slice(home.length)}`; |
| 109 | } |
| 110 | |
| 111 | return `${colors.green}${colors.bold}user@virtual${colors.reset}:${colors.blue}${colors.bold}${displayCwd}${colors.reset}$ `; |
| 112 | } |
| 113 | |
| 114 | private async executeCommand(command: string): Promise<void> { |
| 115 | const trimmed = command.trim(); |