Skip to content

Commit

Permalink
Remove "*" arg defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
pederhan committed Oct 24, 2024
1 parent 3c6086a commit 6332273
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion zabbix_cli/commands/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ def show_hosts(

with app.status("Fetching hosts..."):
hosts = app.state.client.get_hosts(
*hostnames_or_ids or "*", # default to all hosts wildcard pattern
*hostnames_or_ids,
select_groups=True,
select_templates=True,
sort_field="host",
Expand Down
4 changes: 2 additions & 2 deletions zabbix_cli/commands/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,11 @@ def show_proxies(
from zabbix_cli.commands.results.proxy import ShowProxiesResult
from zabbix_cli.models import AggregateResult

names_or_ids = parse_list_arg(name_or_id) if name_or_id else None
names_or_ids = parse_list_arg(name_or_id)

with app.status("Fetching proxies..."):
proxies = app.state.client.get_proxies(
*names_or_ids or "*",
*names_or_ids,
select_hosts=True,
)
render_result(
Expand Down
16 changes: 9 additions & 7 deletions zabbix_cli/commands/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from itertools import chain
from typing import TYPE_CHECKING
from typing import List
from typing import Optional
from typing import Union

import typer
Expand Down Expand Up @@ -555,26 +556,27 @@ def show_template(
@app.command("show_templates", rich_help_panel=HELP_PANEL)
def show_templates(
ctx: typer.Context,
templates: str = typer.Argument(
"*",
templates: Optional[str] = typer.Argument(
None,
help="Template name(s) or ID(s). Comma-separated. Supports wildcards.",
show_default=False,
),
) -> None:
"""Show one or more templates.
"""Show all templates.
Shows all templates by default. The template name can be a pattern containing wildcards.
Names and IDs cannot be mixed.
"""
from zabbix_cli.models import AggregateResult

args = parse_list_arg(templates)
tmpls = app.state.client.get_templates(
*args,
template_names_or_ids = parse_list_arg(templates)
tpls = app.state.client.get_templates(
*template_names_or_ids,
select_hosts=True,
select_templates=True,
select_parent_templates=True,
)
render_result(AggregateResult(result=tmpls))
render_result(AggregateResult(result=tpls))


@app.command(
Expand Down

0 comments on commit 6332273

Please sign in to comment.