dfdf
This commit is contained in:
@@ -136,33 +136,10 @@ def _run_op(op: str, data: Any) -> Dict[str, Any]:
|
||||
|
||||
# Provide store backend choices using the same source as CLI/Typer autocomplete.
|
||||
if op_name in {"store-choices", "store_choices", "get-store-choices", "get_store_choices"}:
|
||||
# Preferred: call the same choice function used by the CLI completer.
|
||||
try:
|
||||
from CLI import get_store_choices # noqa: WPS433
|
||||
from CLI import MedeiaCLI # noqa: WPS433
|
||||
|
||||
backends = get_store_choices()
|
||||
choices = sorted({str(n) for n in (backends or []) if str(n).strip()})
|
||||
except Exception:
|
||||
# Fallback: direct Store registry enumeration using loaded config.
|
||||
try:
|
||||
cfg = load_config() or {}
|
||||
except Exception:
|
||||
cfg = {}
|
||||
try:
|
||||
from Store import Store # noqa: WPS433
|
||||
|
||||
storage = Store(cfg, suppress_debug=True)
|
||||
backends = storage.list_backends() or []
|
||||
choices = sorted({str(n) for n in backends if str(n).strip()})
|
||||
except Exception as exc:
|
||||
return {
|
||||
"success": False,
|
||||
"stdout": "",
|
||||
"stderr": "",
|
||||
"error": f"{type(exc).__name__}: {exc}",
|
||||
"table": None,
|
||||
"choices": [],
|
||||
}
|
||||
backends = MedeiaCLI.get_store_choices()
|
||||
choices = sorted({str(n) for n in (backends or []) if str(n).strip()})
|
||||
|
||||
return {
|
||||
"success": True,
|
||||
|
||||
Reference in New Issue
Block a user