summaryrefslogtreecommitdiffstats
path: root/test/lib/ansible_test/_internal/cli/commands/coverage/analyze/targets/combine.py
blob: 7fa49bf9b21f6179fe0cbb5e495b8bc57d138f0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""Command line parsing for the `coverage analyze targets combine` command."""
from __future__ import annotations

import argparse

from ......commands.coverage.analyze.targets.combine import (
    command_coverage_analyze_targets_combine,
    CoverageAnalyzeTargetsCombineConfig,
)

from .....environments import (
    CompositeActionCompletionFinder,
    ControllerMode,
    TargetMode,
    add_environments,
)


def do_combine(
    subparsers,
    parent: argparse.ArgumentParser,
    completer: CompositeActionCompletionFinder,
):
    """Command line parsing for the `coverage analyze targets combine` command."""
    parser: argparse.ArgumentParser = subparsers.add_parser(
        'combine',
        parents=[parent],
        help='combine multiple aggregated coverage files',
    )

    parser.set_defaults(
        func=command_coverage_analyze_targets_combine,
        config=CoverageAnalyzeTargetsCombineConfig,
    )

    targets_combine = parser.add_argument_group('coverage arguments')

    targets_combine.add_argument(
        'input_file',
        nargs='+',
        help='input file to read aggregated coverage from',
    )

    targets_combine.add_argument(
        'output_file',
        help='output file to write aggregated coverage to',
    )

    add_environments(parser, completer, ControllerMode.ORIGIN, TargetMode.NO_TARGETS)  # coverage analyze targets combine