updated
This commit is contained in:
@@ -506,16 +506,40 @@ class CmdletIntrospection:
|
||||
if normalized_arg == "plugin":
|
||||
canonical_cmd = (cmd_name or "").replace("_", "-").lower()
|
||||
try:
|
||||
from ProviderCore.registry import list_configured_plugin_names_with_capability
|
||||
from ProviderCore.registry import (
|
||||
list_configured_plugin_names_with_capability,
|
||||
list_plugin_names_for_cmdlet,
|
||||
)
|
||||
except Exception:
|
||||
list_configured_plugin_names_with_capability = None # type: ignore
|
||||
list_plugin_names_for_cmdlet = None # type: ignore
|
||||
|
||||
plugin_choices: List[str] = []
|
||||
|
||||
if canonical_cmd in {"add-file"} and list_configured_plugin_names_with_capability is not None:
|
||||
return list_configured_plugin_names_with_capability("upload", config) or []
|
||||
|
||||
if list_configured_plugin_names_with_capability is not None:
|
||||
if list_plugin_names_for_cmdlet is not None:
|
||||
configured = list_plugin_names_for_cmdlet(
|
||||
canonical_cmd,
|
||||
config,
|
||||
configured_only=True,
|
||||
) or []
|
||||
available = list_plugin_names_for_cmdlet(
|
||||
canonical_cmd,
|
||||
config,
|
||||
configured_only=False,
|
||||
) or []
|
||||
# Prefer configured plugins first, but still show valid plugin options.
|
||||
seen: Set[str] = set()
|
||||
merged: List[str] = []
|
||||
for entry in [*configured, *available]:
|
||||
key = str(entry or "").strip().lower()
|
||||
if not key or key in seen:
|
||||
continue
|
||||
seen.add(key)
|
||||
merged.append(str(entry))
|
||||
plugin_choices = merged
|
||||
elif canonical_cmd in {"add-file"} and list_configured_plugin_names_with_capability is not None:
|
||||
plugin_choices = list_configured_plugin_names_with_capability("upload", config) or []
|
||||
elif list_configured_plugin_names_with_capability is not None:
|
||||
plugin_choices = list_configured_plugin_names_with_capability("search", config) or []
|
||||
|
||||
if plugin_choices:
|
||||
|
||||
Reference in New Issue
Block a user