Skip to content

Commit

Permalink
Cloup - unify conditions (RedHatQE#2024)
Browse files Browse the repository at this point in the history
  • Loading branch information
rnetser authored Aug 13, 2024
1 parent f718a3e commit ca65710
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions class_generator/class_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import re

import cloup
from cloup.constraints import If, accept_none, mutually_exclusive, require_any
from cloup.constraints import If, IsSet, accept_none, require_one
from pyhelper_utils.shell import run_command
import pytest
from rich.console import Console
Expand Down Expand Up @@ -731,12 +731,21 @@ def generate_class_generator_tests() -> None:
is_flag=True,
show_default=True,
)
@cloup.constraint(mutually_exclusive, ["add_tests", "debug"])
@cloup.constraint(mutually_exclusive, ["add_tests", "output_file"])
@cloup.constraint(mutually_exclusive, ["add_tests", "dry_run"])
@cloup.constraint(mutually_exclusive, ["interactive", "kind"])
@cloup.constraint(If("debug_file", then=accept_none), ["interactive", "kind"])
@cloup.constraint(require_any, ["interactive", "kind"])
@cloup.constraint(
If(
IsSet("add_tests"),
then=accept_none,
),
["debug", "output_file", "dry_run"],
)
@cloup.constraint(
If(
IsSet("debug_file"),
then=accept_none,
else_=require_one,
),
["interactive", "kind"],
)
def main(
kind: str,
overwrite: bool,
Expand Down

0 comments on commit ca65710

Please sign in to comment.