update and cleanup repo
This commit is contained in:
+4
-14
@@ -4,6 +4,8 @@ import os
|
||||
from importlib import import_module
|
||||
from typing import Any, Callable, Dict, Sequence
|
||||
|
||||
from SYS.cmdlet_spec import collect_registered_cmdlet_names
|
||||
|
||||
CmdletFn = Callable[[Any, Sequence[str], Dict[str, Any]], int]
|
||||
|
||||
|
||||
@@ -12,20 +14,8 @@ def _register_cmdlet_object(cmdlet_obj, registry: Dict[str, CmdletFn]) -> None:
|
||||
if not callable(run_fn):
|
||||
return
|
||||
|
||||
if hasattr(cmdlet_obj, "name") and cmdlet_obj.name:
|
||||
registry[cmdlet_obj.name.replace("_", "-").lower()] = run_fn
|
||||
|
||||
# Cmdlet uses 'alias' (List[str]). Some older objects may use 'aliases'.
|
||||
aliases: list[str] = []
|
||||
if hasattr(cmdlet_obj, "alias") and getattr(cmdlet_obj, "alias"):
|
||||
aliases.extend(getattr(cmdlet_obj, "alias") or [])
|
||||
if hasattr(cmdlet_obj, "aliases") and getattr(cmdlet_obj, "aliases"):
|
||||
aliases.extend(getattr(cmdlet_obj, "aliases") or [])
|
||||
|
||||
for alias in aliases:
|
||||
if not alias:
|
||||
continue
|
||||
registry[alias.replace("_", "-").lower()] = run_fn
|
||||
for registered_name in collect_registered_cmdlet_names(cmdlet_obj):
|
||||
registry[registered_name] = run_fn
|
||||
|
||||
|
||||
def _iter_legacy_native_module_names() -> list[str]:
|
||||
|
||||
Reference in New Issue
Block a user