summaryrefslogtreecommitdiffstats
path: root/anta/cli/check/commands.py
blob: 8208d6459d289e2a37835029b68a31c957c625eb (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
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
# pylint: disable = redefined-outer-name
"""
Click commands to validate configuration files
"""
from __future__ import annotations

import logging

import click
from rich.pretty import pretty_repr

from anta.catalog import AntaCatalog
from anta.cli.console import console
from anta.cli.utils import catalog_options

logger = logging.getLogger(__name__)


@click.command
@catalog_options
def catalog(catalog: AntaCatalog) -> None:
    """
    Check that the catalog is valid
    """
    console.print(f"[bold][green]Catalog is valid: {catalog.filename}")
    console.print(pretty_repr(catalog.tests))