• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

binbashar / leverage / 11669812051

04 Nov 2024 05:51PM UTC coverage: 60.037% (+0.1%) from 59.901%
11669812051

push

github

web-flow
chore: deprecate python 3.8 (#289)

* Deprecate python 3.8

* Update lock file

* Drop python 3.12 from tests

* Drop python 3.12

* Bump yaenv version

182 of 446 branches covered (40.81%)

Branch coverage included in aggregate %.

2438 of 3918 relevant lines covered (62.23%)

0.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

33.33
/leverage/modules/utils.py
1
import click
1✔
2
from click.exceptions import Exit
1✔
3

4

5
def _handle_subcommand(context, cli_container, args, caller_name=None):
1✔
6
    """Decide if command corresponds to a wrapped one or not and run accordingly.
7

8
    Args:
9
        context (click.context): Current context
10
        cli_container (LeverageContainer): Container where commands will be executed
11
        args (tuple(str)): Arguments received by Leverage
12
        caller_name (str, optional): Calling command. Defaults to None.
13

14
    Raises:
15
        Exit: Whenever container execution returns a non-zero exit code
16
    """
17
    caller_pos = args.index(caller_name) if caller_name is not None else 0
×
18

19
    # Find if one of the wrapped subcommand was invoked
20
    wrapped_subcommands = context.command.commands.keys()
×
21
    subcommand = next((arg for arg in args[caller_pos:] if arg in wrapped_subcommands), None)
×
22

23
    if subcommand is None:
×
24
        # Pass command to the container directly
25
        exit_code = cli_container.start(" ".join(args))
×
26
        if not exit_code:
×
27
            raise Exit(exit_code)
×
28

29
    else:
30
        # Invoke wrapped command
31
        subcommand = context.command.commands.get(subcommand)
×
32
        if not subcommand.params:
×
33
            context.invoke(subcommand)
×
34
        else:
35
            context.forward(subcommand)
×
36

37

38
mount_option = click.option("--mount", multiple=True, type=click.Tuple([str, str]))
1✔
39
env_var_option = click.option("--env-var", multiple=True, type=click.Tuple([str, str]))
1✔
40
auth_mfa = click.option(
1✔
41
    "--mfa", is_flag=True, default=False, help="Enable Multi Factor Authentication upon launching shell."
42
)
43
auth_sso = click.option("--sso", is_flag=True, default=False, help="Enable SSO Authentication upon launching shell.")
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc