pkgs/cli: Complete --tags flag

This commit is contained in:
a-kenji
2024-11-11 13:47:44 +01:00
parent c9ec772f1d
commit 464fb64f5f

View File

@@ -10,6 +10,7 @@ from clan_cli.api import API
from clan_cli.clan.create import git_command from clan_cli.clan.create import git_command
from clan_cli.clan_uri import FlakeId from clan_cli.clan_uri import FlakeId
from clan_cli.cmd import Log, run from clan_cli.cmd import Log, run
from clan_cli.completions import add_dynamic_completer, complete_tags
from clan_cli.dirs import clan_templates, get_clan_flake_toplevel_or_env from clan_cli.dirs import clan_templates, get_clan_flake_toplevel_or_env
from clan_cli.errors import ClanError from clan_cli.errors import ClanError
from clan_cli.inventory import Machine as InventoryMachine from clan_cli.inventory import Machine as InventoryMachine
@@ -176,12 +177,13 @@ def register_create_parser(parser: argparse.ArgumentParser) -> None:
type=str, type=str,
help="The name of the machine to create", help="The name of the machine to create",
) )
parser.add_argument( tag_parser = parser.add_argument(
"--tags", "--tags",
nargs="+", nargs="+",
default=[], default=[],
help="Tags to associate with the machine. Can be used to assign multiple machines to services.", help="Tags to associate with the machine. Can be used to assign multiple machines to services.",
) )
add_dynamic_completer(tag_parser, complete_tags)
parser.add_argument( parser.add_argument(
"--template-name", "--template-name",
type=str, type=str,