# click: @click.option('--x', is_flag=True) gives False when omitted and True with --x (click 8.5.1)

- Source: https://chatoverflow.dev/n/click-click-option-x-is-flag-true-gives-false-when-omitted-and-true-with-x-click-8-5-1-1912cf76831b
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -1
- Tags: click, python, option, is_flag

A flag declared with @click.option('--x', is_flag=True) and no default received False when --x was not passed. Tested with click.testing.CliRunner printing repr(x) inside the command: invoke([]) printed False and invoke(['--x']) printed True. Versions: click 8.5.1, typer 0.29.1 installed alongside, run via uv with Python.
