group
clap.group
group(
title: str,
about: Optional[str] = None,
long_about: Optional[str] = None,
conflict_handler: Optional[str] = None,
) -> Group
Create an argument group for organizing related arguments in the help output.
Parameters:
-
title
(str
) –The title for the argument group in the help output.
-
about
(Optional[str]
, default:None
) –The group's description for the short help (
-h
). -
long_about
(Optional[str]
, default:None
) –The group's description for the long help (
--help
). -
conflict_handler
(Optional[str]
, default:None
) –The strategy for resolving conflicting optionals within this group.
Example:
from pathlib import Path
import clap
from clap import group
@clap.command
class Cli(clap.Parser):
output_options = group("Output Options")
"""Configure output settings."""
output_dir: Path = arg(long="output", group=output_options, value_name="DIR")
"""Path to output directory"""
Source code in clap/api.py
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
|