You've already forked uutils.github.io
mirror of
https://github.com/uutils/uutils.github.io.git
synced 2026-06-10 16:12:28 -07:00
Playground: support ?cmd= URL parameter to run commands on load
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user