forked from clan/clan-core
clan: add completion function for clan users
This commit is contained in:
parent
4e95030e55
commit
e7e5a1ded8
@ -144,6 +144,27 @@ def complete_secrets(
|
||||
return secrets_dict
|
||||
|
||||
|
||||
def complete_users(
|
||||
prefix: str, parsed_args: argparse.Namespace, **kwargs: Any
|
||||
) -> Iterable[str]:
|
||||
"""
|
||||
Provides completion functionality for clan users
|
||||
"""
|
||||
from pathlib import Path
|
||||
|
||||
from .secrets.users import list_users
|
||||
|
||||
if (clan_dir_result := clan_dir(None)) is not None:
|
||||
flake = clan_dir_result
|
||||
else:
|
||||
flake = "."
|
||||
|
||||
users = list_users(Path(flake))
|
||||
|
||||
users_dict = {name: "user" for name in users}
|
||||
return users_dict
|
||||
|
||||
|
||||
def add_dynamic_completer(
|
||||
action: argparse.Action,
|
||||
completer: Callable[..., Iterable[str]],
|
||||
|
Loading…
Reference in New Issue
Block a user