From 2cbd80d6fda4b682bc0255a023df5ed6592985f7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 4 Apr 2026 11:20:21 +0200 Subject: [PATCH] Playground: support ?cmd= URL parameter to run commands on load --- static/js/wasm-terminal.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/static/js/wasm-terminal.js b/static/js/wasm-terminal.js index 52aa7768c..7b7c18496 100644 --- a/static/js/wasm-terminal.js +++ b/static/js/wasm-terminal.js @@ -748,7 +748,15 @@ async function initPlayground(containerId) { terminal.writeln("Type \x1b[1;32mhelp\x1b[0m for available commands."); } - prompt(); + // Run command(s) from URL ?cmd= parameter if present + const urlCmd = new URLSearchParams(window.location.search).get("cmd"); + if (urlCmd) { + for (const cmd of urlCmd.split("\n")) { + if (cmd.trim()) await runInTerminal(cmd.trim()); + } + } else { + prompt(); + } } /**