This commit is contained in:
2026-01-11 01:22:51 -08:00
parent 29034b41b4
commit 450a923273
3 changed files with 22 additions and 19 deletions

View File

@@ -28,7 +28,7 @@ CMDLET = Cmdlet(
detail=[
"Use a registered provider to build a table and optionally run another cmdlet with selection args.",
"Emits pipeline-friendly dicts enriched with `_selection_args` so you can pipe into `select` and other cmdlets.",
"Example: provider-table -provider example -sample | select -select 1 | add-file -store default",
"Example: provider-table -provider example -sample | select -select 1 | add-file -store my_store",
],
)

View File

@@ -573,15 +573,26 @@ class search_file(Cmdlet):
library_root = get_local_storage_path(config or {})
if not library_root:
# Fallback for search-file: if no global "default" path is found,
# Fallback for search-file: if no global folder path is found,
# try to use the specific backend mentioned in -store or the first available folder backend.
backend_name = storage_backend or "default"
try:
backend = storage_registry[backend_name]
if backend and type(backend).__name__ == "Folder":
library_root = expand_path(getattr(backend, "_location", None))
except Exception:
pass
if storage_backend:
try:
backend = storage_registry[storage_backend]
if backend and type(backend).__name__ == "Folder":
library_root = expand_path(getattr(backend, "_location", None))
except Exception:
pass
else:
# Try all backends until we find a Folder one
for name in storage_registry.list_backends():
try:
backend = storage_registry[name]
if type(backend).__name__ == "Folder":
library_root = expand_path(getattr(backend, "_location", None))
if library_root:
break
except Exception:
continue
if not library_root:
log("No library root configured. Use the .config command to set up storage.", file=sys.stderr)