update screenshot

This commit is contained in:
2026-04-21 10:31:38 -07:00
parent f8230bab9c
commit 10e3cd009b
8 changed files with 1218 additions and 439 deletions
+9 -20
View File
@@ -228,23 +228,18 @@ class SharedArgs:
if not force and hasattr(SharedArgs, "_cached_available_stores"):
return SharedArgs._cached_available_stores or []
# Refresh the cache. When not forcing, prefer a lightweight configured-name
# pass to avoid instantiating backends (which may perform work such as opening DBs).
if not force:
SharedArgs._refresh_store_choices_cache(config, skip_instantiation=True)
else:
SharedArgs._refresh_store_choices_cache(config, skip_instantiation=False)
# Autocomplete and shared arg choices must only expose backends that actually
# initialized successfully. Do a full refresh when the cache is missing.
SharedArgs._refresh_store_choices_cache(config, skip_instantiation=False)
return SharedArgs._cached_available_stores or []
@staticmethod
def _refresh_store_choices_cache(config: Optional[Dict[str, Any]] = None, skip_instantiation: bool = False) -> None:
"""Refresh the cached store choices list. Should be called once at startup.
This performs a lightweight pass first (reads configured names only, without
instantiating backend classes) to avoid side-effects during autocompletion or
other quick lookups. When `skip_instantiation` is False, the function will
attempt a full StoreRegistry initialization to filter out backends that failed
to initialize properly.
Store choices are user-facing and should only include backends that actually
initialized successfully. When `skip_instantiation` is True, this method keeps
the cache empty rather than surfacing configured-but-disabled store names.
Args:
config: Config dict. If not provided, will try to load from config module.
@@ -259,15 +254,10 @@ class SharedArgs:
SharedArgs._cached_available_stores = []
return
# Lightweight pass: return configured names without instantiating backends
try:
from Store.registry import list_configured_backend_names
SharedArgs._cached_available_stores = list_configured_backend_names(config) or []
except Exception:
SharedArgs._cached_available_stores = []
SharedArgs._cached_available_stores = []
# If caller explicitly requested a full scan, instantiate registry to get
# only backends that actually initialized successfully.
# If caller requested a lightweight pass, avoid exposing configured names
# that may be disabled or unavailable.
if skip_instantiation:
return
@@ -278,7 +268,6 @@ class SharedArgs:
if available:
SharedArgs._cached_available_stores = available
except Exception:
# Keep the lightweight list if full initialization fails
pass
except Exception:
SharedArgs._cached_available_stores = []
+29
View File
@@ -338,6 +338,14 @@ class Add_File(Cmdlet):
except Exception:
is_storage_backend_location = False
if location and not plugin_name and not is_storage_backend_location:
if not Add_File._looks_like_local_export_target(str(location)):
log(
f"Storage backend '{location}' not found. Use -path for local export or configure that store backend.",
file=sys.stderr,
)
return 1
# Decide which items to process.
# - If directory scan was performed, use those results
# - If user provided -path (and it was not reinterpreted as destination), treat this invocation as single-item.
@@ -1262,6 +1270,27 @@ class Add_File(Cmdlet):
pass
return None
@staticmethod
def _looks_like_local_export_target(location: str) -> bool:
target = str(location or "").strip()
if not target:
return False
target_path = Path(target).expanduser()
try:
if target_path.exists():
return True
except Exception:
pass
if target.startswith((".", "~")):
return True
if "\\" in target or "/" in target:
return True
if len(target) >= 2 and target[1] == ":":
return True
return False
@staticmethod
def _resolve_source(
result: Any,
+890 -344
View File
File diff suppressed because it is too large Load Diff