summaryrefslogtreecommitdiffstats
path: root/anta/cli/nrfu/commands.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--anta/cli/nrfu/commands.py37
1 files changed, 20 insertions, 17 deletions
diff --git a/anta/cli/nrfu/commands.py b/anta/cli/nrfu/commands.py
index a0acfc9..4dd779b 100644
--- a/anta/cli/nrfu/commands.py
+++ b/anta/cli/nrfu/commands.py
@@ -1,13 +1,13 @@
# 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.
-"""
-Click commands that render ANTA tests results
-"""
+"""Click commands that render ANTA tests results."""
+
from __future__ import annotations
import logging
import pathlib
+from typing import Literal
import click
@@ -20,14 +20,19 @@ logger = logging.getLogger(__name__)
@click.command()
@click.pass_context
-@click.option("--device", "-d", help="Show a summary for this device", type=str, required=False)
-@click.option("--test", "-t", help="Show a summary for this test", type=str, required=False)
@click.option(
- "--group-by", default=None, type=click.Choice(["device", "test"], case_sensitive=False), help="Group result by test or host. default none", required=False
+ "--group-by",
+ default=None,
+ type=click.Choice(["device", "test"], case_sensitive=False),
+ help="Group result by test or device.",
+ required=False,
)
-def table(ctx: click.Context, device: str | None, test: str | None, group_by: str) -> None:
- """ANTA command to check network states with table result"""
- print_table(results=ctx.obj["result_manager"], device=device, group_by=group_by, test=test)
+def table(
+ ctx: click.Context,
+ group_by: Literal["device", "test"] | None,
+) -> None:
+ """ANTA command to check network states with table result."""
+ print_table(ctx, group_by=group_by)
exit_with_code(ctx)
@@ -42,18 +47,16 @@ def table(ctx: click.Context, device: str | None, test: str | None, group_by: st
help="Path to save report as a file",
)
def json(ctx: click.Context, output: pathlib.Path | None) -> None:
- """ANTA command to check network state with JSON result"""
- print_json(results=ctx.obj["result_manager"], output=output)
+ """ANTA command to check network state with JSON result."""
+ print_json(ctx, output=output)
exit_with_code(ctx)
@click.command()
@click.pass_context
-@click.option("--search", "-s", help="Regular expression to search in both name and test", type=str, required=False)
-@click.option("--skip-error", help="Hide tests in errors due to connectivity issue", default=False, is_flag=True, show_default=True, required=False)
-def text(ctx: click.Context, search: str | None, skip_error: bool) -> None:
- """ANTA command to check network states with text result"""
- print_text(results=ctx.obj["result_manager"], search=search, skip_error=skip_error)
+def text(ctx: click.Context) -> None:
+ """ANTA command to check network states with text result."""
+ print_text(ctx)
exit_with_code(ctx)
@@ -76,6 +79,6 @@ def text(ctx: click.Context, search: str | None, skip_error: bool) -> None:
help="Path to save report as a file",
)
def tpl_report(ctx: click.Context, template: pathlib.Path, output: pathlib.Path | None) -> None:
- """ANTA command to check network state with templated report"""
+ """ANTA command to check network state with templated report."""
print_jinja(results=ctx.obj["result_manager"], template=template, output=output)
exit_with_code(ctx)