| 45 | } |
| 46 | |
| 47 | export default class InteractiveUserInterface implements UserInterface { |
| 48 | private terminal: Terminal; |
| 49 | private logs: Logs = new Logs(); |
| 50 | private compilations: { |
| 51 | [platform: string]: { |
| 52 | value: number; |
| 53 | title: string; |
| 54 | x: number; |
| 55 | y: number; |
| 56 | running: boolean; |
| 57 | width: number; |
| 58 | }; |
| 59 | } = {}; |
| 60 | private LOGS_START_Y = 3; |
| 61 | |
| 62 | constructor(terminal: Terminal) { |
| 63 | this.terminal = terminal; |
| 64 | } |
| 65 | |
| 66 | renderLogsSection() { |
| 67 | this.terminal.moveTo(0, 0); |
| 68 | this.terminal.eraseLine(); |
| 69 | this.terminal( |
| 70 | container( |
| 71 | color('gray', '['), |
| 72 | color('blue', modifier('bold', 'Logs')), |
| 73 | color('gray', ']') |
| 74 | ).build() |
| 75 | ); |
| 76 | } |
| 77 | |
| 78 | renderCompilationsSection(platforms: string[]) { |
| 79 | this.terminal.moveTo(0, this.terminal.height - platforms.length - 2); |
| 80 | this.terminal( |
| 81 | container( |
| 82 | color('gray', '['), |
| 83 | color('blue', modifier('bold', 'Compilations')), |
| 84 | color('gray', ']') |
| 85 | ).build() |
| 86 | ); |
| 87 | } |
| 88 | |
| 89 | createCompilations(platforms: string[]) { |
| 90 | const leftMargin = 4; |
| 91 | const platformNameLength = Math.max( |
| 92 | ...platforms.map(platform => platform.length) |
| 93 | ); |
| 94 | |
| 95 | platforms.forEach((platform, index) => { |
| 96 | this.compilations[platform] = { |
| 97 | width: Math.min(110, this.terminal.width) - (platformNameLength + 22), |
| 98 | value: 0, |
| 99 | title: `${' '.repeat( |
| 100 | platformNameLength - platform.length |
| 101 | )}${platform.toUpperCase()}:`, |
| 102 | x: leftMargin, |
| 103 | y: this.terminal.height - platforms.length + index, |
| 104 | running: false, |
nothing calls this directly
no outgoing calls
no test coverage detected