update and cleanup repo
This commit is contained in:
+7
-21
@@ -4,7 +4,7 @@ from typing import Any, Dict, Sequence, List, Optional, Tuple
|
||||
import shlex
|
||||
import sys
|
||||
|
||||
from SYS.cmdlet_spec import Cmdlet, CmdletArg, parse_cmdlet_args
|
||||
from SYS.cmdlet_spec import Cmdlet, CmdletArg, collect_registered_cmdlet_names, parse_cmdlet_args
|
||||
from cmdlet import REGISTRY as CMDLET_REGISTRY, ensure_cmdlet_modules_loaded
|
||||
from SYS.logger import log
|
||||
from SYS.result_table import Table
|
||||
@@ -53,26 +53,12 @@ def _normalize_cmdlet_key(name: Optional[str]) -> str:
|
||||
|
||||
|
||||
def _cmdlet_aliases(cmdlet_obj: Cmdlet) -> List[str]:
|
||||
aliases: List[str] = []
|
||||
for attr in ("alias", "aliases"):
|
||||
raw_aliases = getattr(cmdlet_obj, attr, None)
|
||||
if isinstance(raw_aliases, (list, tuple, set)):
|
||||
candidates = raw_aliases
|
||||
else:
|
||||
candidates = (raw_aliases,)
|
||||
for alias in candidates or ():
|
||||
text = str(alias or "").strip()
|
||||
if text:
|
||||
aliases.append(text)
|
||||
seen: set[str] = set()
|
||||
deduped: List[str] = []
|
||||
for alias in aliases:
|
||||
key = alias.lower()
|
||||
if key in seen:
|
||||
continue
|
||||
seen.add(key)
|
||||
deduped.append(alias)
|
||||
return deduped
|
||||
canonical_name = _normalize_cmdlet_key(getattr(cmdlet_obj, "name", None))
|
||||
return [
|
||||
registered_name
|
||||
for registered_name in collect_registered_cmdlet_names(cmdlet_obj)
|
||||
if registered_name != canonical_name
|
||||
]
|
||||
|
||||
|
||||
def _cmdlet_arg_to_dict(arg: CmdletArg) -> Dict[str, Any]:
|
||||
|
||||
Reference in New Issue
Block a user