GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Reject flag tokens as values in dev-runner arg parsing · atscub/t3code@c9a59a2

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • scripts
    • dev-runner.mjs
    • dev-runner.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎scripts/dev-runner.mjs‎

Copy file name to clipboardExpand all lines: scripts/dev-runner.mjs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export function parseDevRunnerArgs(rawArgs) {
131131
let value = parsedFlag.value;
132132
if (value === undefined) {
133133
const next = args[index + 1];
134-
if (next === undefined) {
134+
if (next === undefined || next === "--" || next.startsWith("-")) {
135135
throw new Error(`Missing value for --${parsedFlag.name}`);
136136
}
137137
value = next;
Collapse file

‎scripts/dev-runner.test.ts‎

Copy file name to clipboardExpand all lines: scripts/dev-runner.test.ts
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ describe("parseDevRunnerArgs", () => {
3030
it("throws when a value flag is missing its value", () => {
3131
expect(() => parseDevRunnerArgs(["--state-dir"])).toThrow("Missing value for --state-dir");
3232
});
33+
34+
it("throws when a value flag is followed by another flag token", () => {
35+
expect(() => parseDevRunnerArgs(["--state-dir", "--continue"])).toThrow(
36+
"Missing value for --state-dir",
37+
);
38+
});
3339
});
3440

3541
describe("createDevRunnerEnv", () => {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.