Skip to content

Generated boolean options can only be set to true (no way to send false) #58

Open

Description

@anilonayy

Summary

Every boolean field in the generated commands is registered as a bare commander flag (.option('--autoDeploy', ...)). Passing the flag sends true; there is no way to send false. So you can't turn a setting off from the CLI, e.g. disabling auto-deploy, preview deployments, cleanCache or enabled on a schedule/notification.

For the handful of required boolean inputs (e.g. --isEnabled, --createEnvFile, --enabled), the CLI forces you to pass the flag, so those commands can only ever send true.

Reproduction (@dokploy/cli 0.30.7)

dokploy application update --applicationId <id> --autoDeploy false
# error: too many arguments for 'update'. Expected 0 arguments but got 1.

dokploy application update --applicationId <id> --autoDeploy=false
# error: unknown option '--autoDeploy=false'

dokploy application update --applicationId <id> --no-autoDeploy
# error: unknown option '--no-autoDeploy'

The generated code already converts the string "false" for booleans (opts.x === true || opts.x === "true"), but because the option takes no value, that string can never reach it.

Expected

Some way to send false, e.g. commander's standard negated flag:

dokploy application update --applicationId <id> --no-autoDeploy
# -> {"applicationId":"<id>","autoDeploy":false}

Omitted booleans should still be left out of the request entirely, so a partial update doesn't overwrite unrelated settings.

Root cause

generateOptionLine in scripts/generate.ts emits --<name> for boolean fields and never defines --no-<name>.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions