Allow specifying commandline options

This commit is contained in:
momo5502
2025-08-12 20:43:33 +02:00
parent 2681c7c97e
commit 23001dcbab
4 changed files with 48 additions and 0 deletions

21
page/package-lock.json generated
View File

@@ -37,6 +37,7 @@
"react-resizable-panels": "^3.0.4",
"react-router-dom": "^7.7.1",
"react-window": "^1.8.11",
"shell-quote": "^1.8.3",
"tailwind-merge": "^3.3.1",
"tailwindcss": "^4.1.11",
"tw-animate-css": "^1.3.6",
@@ -49,6 +50,7 @@
"@types/react": "^19.1.9",
"@types/react-dom": "^19.1.7",
"@types/react-helmet": "^6.1.11",
"@types/shell-quote": "^1.7.5",
"@vitejs/plugin-react": "^4.7.0",
"eslint": "^9.32.0",
"eslint-plugin-react-hooks": "^6.0.0",
@@ -3169,6 +3171,13 @@
"@types/react": "*"
}
},
"node_modules/@types/shell-quote": {
"version": "1.7.5",
"resolved": "https://registry.npmjs.org/@types/shell-quote/-/shell-quote-1.7.5.tgz",
"integrity": "sha512-+UE8GAGRPbJVQDdxi16dgadcBfQ+KG2vgZhV1+3A1XmHbmwcdwhCUwIdy+d3pAGrbvgRoVSjeI9vOWyq376Yzw==",
"dev": true,
"license": "MIT"
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.38.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.38.0.tgz",
@@ -5546,6 +5555,18 @@
"node": ">=8"
}
},
"node_modules/shell-quote": {
"version": "1.8.3",
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz",
"integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/source-map-js": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",

View File

@@ -39,6 +39,7 @@
"react-resizable-panels": "^3.0.4",
"react-router-dom": "^7.7.1",
"react-window": "^1.8.11",
"shell-quote": "^1.8.3",
"tailwind-merge": "^3.3.1",
"tailwindcss": "^4.1.11",
"tw-animate-css": "^1.3.6",
@@ -51,6 +52,7 @@
"@types/react": "^19.1.9",
"@types/react-dom": "^19.1.7",
"@types/react-helmet": "^6.1.11",
"@types/shell-quote": "^1.7.5",
"@vitejs/plugin-react": "^4.7.0",
"eslint": "^9.32.0",
"eslint-plugin-react-hooks": "^6.0.0",

View File

@@ -12,6 +12,7 @@ import {
PopoverTrigger,
} from "@/components/ui/popover";
import { ChevronDown } from "react-bootstrap-icons";
import { Input } from "./ui/input";
interface SettingsMenuProps {
settings: Settings;
@@ -54,6 +55,10 @@ export class SettingsMenu extends React.Component<SettingsMenuProps, Settings> {
}
}
updateArgv(commandLine: string) {
this.setState({ commandLine });
}
render() {
return (
<div className="grid gap-4">
@@ -64,6 +69,15 @@ export class SettingsMenu extends React.Component<SettingsMenuProps, Settings> {
</p>
</div>
<div className="flex gap-6">
<Input
id="settings-argv"
placeholder="Command-Line Arguments"
value={this.state.commandLine}
onChange={(e) => this.updateArgv(e.target.value)}
/>
</div>
<div className="flex gap-6">
<Checkbox
id="settings-verbose"

View File

@@ -1,3 +1,5 @@
import { parse } from "shell-quote";
export interface Settings {
verbose: boolean;
concise: boolean;
@@ -8,6 +10,7 @@ export interface Settings {
wasm64: boolean;
ignoredFunctions: string[];
interestingModules: string[];
commandLine: string;
}
export function createDefaultSettings(): Settings {
@@ -21,6 +24,7 @@ export function createDefaultSettings(): Settings {
wasm64: false,
ignoredFunctions: [],
interestingModules: [],
commandLine: "",
};
}
@@ -83,5 +87,12 @@ export function translateSettings(settings: Settings): string[] {
switches.push(m);
});
try {
const argv = parse(settings.commandLine) as string[];
switches.push(...argv);
} catch (e) {
console.log(e);
}
return switches;
}