option
Named flag / option definition (can be boolean flag).
option
from __future__ import annotations
from treeparse import option
opt = option(
flags=["--output", "-o"],
arg_type=str,
help="Write output here.",
default=None,
nargs=None,
choices=None,
required=False,
inherit=True, # visible to child commands/groups
flag=False, # True => store_true boolean (no value consumed)
sort_key=0,
)Boolean flags
option(flags=["--verbose", "-v"], flag=True, help="Verbose mode.")
# callback receives verbose: boolrequired=True + flag=True is invalid.
When inherit=True, the option is automatically added to every descendant command's parameter list.