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

binbashar / leverage / 11999658197

24 Nov 2024 09:16PM UTC coverage: 60.419% (+0.4%) from 60.037%
11999658197

Pull #281

github

web-flow
Merge 7e2f57c24 into e92f56ef4
Pull Request #281: [BV-599] Kubeconfig helper

196 of 460 branches covered (42.61%)

Branch coverage included in aggregate %.

52 of 73 new or added lines in 4 files covered. (71.23%)

47 existing lines in 5 files now uncovered.

2518 of 4032 relevant lines covered (62.45%)

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

© 2025 Coveralls, Inc