Skip to content

CLI: boolean flags accept a value, so --check=false turns the check on #241

Description

@tiagolauer

parseFlags (src/cli/index.ts) sets boolean flags before it ever looks at an = value:

if (BOOLEAN_FLAGS.has(name)) {
  flags.set(name, '');
  continue;
}

So --check=false enables the check, and --help=no prints the help. The value is not rejected, not warned about, just dropped — and for --check the CLI then exits 1 on drift, which is the opposite of what the user asked for. In CI that reads as a failing build with no explanation.

Reproduction

$ owlsql generate --url … --check=false
./schema.ts is out of date - run generate to update it: …
$ echo $?
1

Suggested behaviour

Reject a value on a boolean flag the way an unknown flag is already rejected:

Error: --check does not take a value.

(Accepting --check=true|false would work too, but rejecting is smaller and matches the existing "unexpected argument" / "duplicate flag" error style.)

Found in an audit of master @ dc1afdb (v0.1.8).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions