aiida-core
aiida-core copied to clipboard
Help message not displayed when `?` is specified for `InteractiveOption` if type is boolean flag
Example is verdi code setup
, when asked whether it is --on-computer
(i.e. a boolean flag), when submitting ?
instead of a help message, an error with invalid input
is returned:
(aiida_dev) sph@citadel:~/code/aiida/env/dev/aiida-core$ verdi code setup
Report: enter ? for help.
Report: enter ! to ignore the default and set no value.
Installed on target computer? [Y/n]: ?
Error: invalid input
Installed on target computer? [Y/n]:
The reason is that click.core.Option.prompt_for_value
treats boolean options different from others. Instead of calling prompt
if calls confirm
. The former respects the value_proc
callable to we provide, which allows us to process the value and display the help message if a special character is provided, but the latter only accepts y
or n
, and so passing ?
triggers the error.