Skip to content

Commit

Permalink
cli: vulnerability alias to vulnerability list
Browse files Browse the repository at this point in the history
Running pro vulnerability is now an alias for running pro vulnerability
list
  • Loading branch information
lucasmoura committed Oct 24, 2024
1 parent 32c5bb6 commit 79a0741
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 12 deletions.
55 changes: 44 additions & 11 deletions uaclient/cli/vulnerability/__init__.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,57 @@
from uaclient import messages
from uaclient.cli.commands import ProCommand
from uaclient.cli.commands import ProArgument, ProArgumentGroup, ProCommand
from uaclient.cli.parser import HelpCategory
from uaclient.cli.vulnerability.list import list_subcommand
from uaclient.cli.vulnerability.list import action_list, list_subcommand
from uaclient.cli.vulnerability.show import show_subcommand
from uaclient.cli.vulnerability.update import update_subcommand


def action_vulnerability(args, *, cfg, **kwargs):
# Avoiding a circular import
from uaclient.cli import get_parser

get_parser().print_help_for_command("vulnerability")


vulnerability_command = ProCommand(
"vulnerability",
help=messages.CLI_ROOT_VULNERABILITY,
description=messages.CLI_VULNERABILITY_DESC,
help_category=HelpCategory.SECURITY,
preserve_description=True,
action=action_vulnerability,
action=action_list,
subcommands=[show_subcommand, update_subcommand, list_subcommand],
argument_groups=[
ProArgumentGroup(
arguments=[
ProArgument(
"--data-file",
help=messages.CLI_VULNERABILITY_DATA_FILE,
action="store",
),
ProArgument(
"--all",
help=messages.CLI_VULNERABILITY_LIST_ALL,
action="store_true",
),
ProArgument(
"--usns",
help=messages.CLI_VULNERABILITY_LIST_USNS,
action="store_true",
),
ProArgument(
"--unfixable",
help=messages.CLI_VULNERABILITY_LIST_UNFIXABLE,
action="store_true",
),
ProArgument(
"--manifest-file",
help=messages.CLI_VULNERABILITY_LIST_MANIFEST_FILE,
action="store",
),
ProArgument(
"--series",
help=messages.CLI_VULNERABILITY_LIST_SERIES,
action="store",
),
ProArgument(
"--update",
help=messages.CLI_VULNERABILITY_UPDATE,
action="store_true",
),
]
)
],
)
2 changes: 1 addition & 1 deletion uaclient/messages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ class TxtColor:
CLI_VULNERABILITY_DESC = t.gettext(
"""\
Allow users to better visualize the vulnerability issues that affects
the system."""
the system. By default, this command will execute pro vulnerability list"""
)

CLI_VULNERABILITY_DATA_FILE = t.gettext(
Expand Down

0 comments on commit 79a0741

Please sign in to comment.