Skip to content

Commit 2aaf4f0

Browse files
Merge branch 'coder:main' into main
2 parents 49345c2 + c5fee2d commit 2aaf4f0

3 files changed

Lines changed: 24 additions & 7 deletions

File tree

‎package-lock.json‎

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/node/cli.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,11 @@ export const parse = (
436436

437437
const option = options[key]
438438
if (option.type === "boolean") {
439-
;(args[key] as boolean) = true
439+
// Booleans set to false (for example `--flag=false`, which is also how
440+
// false values from the config file are passed in) are ignored.
441+
if (value !== "false") {
442+
;(args[key] as boolean) = true
443+
}
440444
continue
441445
}
442446

‎test/unit/node/cli.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,19 @@ describe("parser", () => {
578578
it("should ignore optional strings set to false", async () => {
579579
expect(parse(["--cert=false"])).toEqual({})
580580
})
581+
it("should ignore booleans set to false", async () => {
582+
expect(parse(["--disable-telemetry=false"])).toEqual({})
583+
})
584+
it("should parse booleans set to false in the config file", () => {
585+
const configContents = `
586+
disable-telemetry: false
587+
disable-update-check: true
588+
`
589+
expect(parseConfigFile(configContents, "/fake-config-path")).toEqual({
590+
config: "/fake-config-path",
591+
"disable-update-check": true,
592+
})
593+
})
581594
it("should use last flag", async () => {
582595
expect(parse(["--port", "8081", "--port", "8082"])).toEqual({
583596
port: 8082,

0 commit comments

Comments
 (0)