k
This commit is contained in:
19
CLI.py
19
CLI.py
@@ -780,9 +780,9 @@ class WorkerStages:
|
||||
class CmdletIntrospection:
|
||||
|
||||
@staticmethod
|
||||
def cmdlet_names() -> List[str]:
|
||||
def cmdlet_names(force: bool = False) -> List[str]:
|
||||
try:
|
||||
return list_cmdlet_names() or []
|
||||
return list_cmdlet_names(force=force) or []
|
||||
except Exception:
|
||||
return []
|
||||
|
||||
@@ -796,11 +796,11 @@ class CmdletIntrospection:
|
||||
return []
|
||||
|
||||
@staticmethod
|
||||
def store_choices(config: Dict[str, Any]) -> List[str]:
|
||||
def store_choices(config: Dict[str, Any], force: bool = False) -> List[str]:
|
||||
try:
|
||||
# Use the cached startup check from SharedArgs
|
||||
from cmdlet._shared import SharedArgs
|
||||
return SharedArgs.get_store_choices(config)
|
||||
return SharedArgs.get_store_choices(config, force=force)
|
||||
except Exception:
|
||||
return []
|
||||
|
||||
@@ -810,12 +810,13 @@ class CmdletIntrospection:
|
||||
cmd_name: str,
|
||||
arg_name: str,
|
||||
config: Dict[str,
|
||||
Any]) -> List[str]:
|
||||
Any],
|
||||
force: bool = False) -> List[str]:
|
||||
try:
|
||||
normalized_arg = (arg_name or "").lstrip("-").strip().lower()
|
||||
|
||||
if normalized_arg in ("storage", "store"):
|
||||
backends = cls.store_choices(config)
|
||||
backends = cls.store_choices(config, force=force)
|
||||
if backends:
|
||||
return backends
|
||||
|
||||
@@ -923,6 +924,9 @@ class CmdletCompleter(Completer):
|
||||
document: Document,
|
||||
complete_event
|
||||
): # type: ignore[override]
|
||||
# Refresh cmdlet names from introspection to pick up dynamic updates
|
||||
self.cmdlet_names = CmdletIntrospection.cmdlet_names(force=True)
|
||||
|
||||
text = document.text_before_cursor
|
||||
tokens = text.split()
|
||||
ends_with_space = bool(text) and text[-1].isspace()
|
||||
@@ -1031,7 +1035,8 @@ class CmdletCompleter(Completer):
|
||||
choices = CmdletIntrospection.arg_choices(
|
||||
cmd_name=cmd_name,
|
||||
arg_name=prev_token,
|
||||
config=config
|
||||
config=config,
|
||||
force=True
|
||||
)
|
||||
if choices:
|
||||
choice_list = choices
|
||||
|
||||
Reference in New Issue
Block a user