(prompt: RunPrompt)
| 266 | } |
| 267 | |
| 268 | const submit = (prompt: RunPrompt) => { |
| 269 | if (!prompt.text.trim() || state.closed) { |
| 270 | return |
| 271 | } |
| 272 | |
| 273 | if (prompt.mode !== "shell" && isExitCommand(prompt.text)) { |
| 274 | input.footer.close() |
| 275 | return |
| 276 | } |
| 277 | |
| 278 | const active = state.active |
| 279 | if ( |
| 280 | active && |
| 281 | active.mode !== "shell" && |
| 282 | !active.command && |
| 283 | prompt.mode !== "shell" && |
| 284 | !prompt.command && |
| 285 | !isNewCommand(prompt.text) |
| 286 | ) { |
| 287 | const queued: FooterQueuedPrompt = { |
| 288 | messageID: MessageID.ascending(), |
| 289 | partID: PartID.ascending(), |
| 290 | prompt, |
| 291 | } |
| 292 | state.queued = [...state.queued, queued] |
| 293 | state.queue.push(prompt) |
| 294 | syncQueue() |
| 295 | return |
| 296 | } |
| 297 | |
| 298 | state.queue.push(prompt) |
| 299 | syncQueue() |
| 300 | if (prompt.mode !== "shell" && isNewCommand(prompt.text)) { |
| 301 | drain() |
| 302 | return |
| 303 | } |
| 304 | |
| 305 | emit( |
| 306 | { |
| 307 | type: "first", |
| 308 | first: false, |
| 309 | }, |
| 310 | { |
| 311 | first: false, |
| 312 | }, |
| 313 | ) |
| 314 | drain() |
| 315 | } |
| 316 | |
| 317 | const offPrompt = input.footer.onPrompt((prompt) => { |
| 318 | submit(prompt) |
no test coverage detected