This commit is contained in:
2026-01-31 23:41:47 -08:00
parent 753cdfb196
commit 95748698fa
15 changed files with 218 additions and 128 deletions

View File

@@ -124,6 +124,7 @@ class Provider(ABC):
"""
URL: Sequence[str] = ()
NAME: str = ""
# Optional provider-driven defaults for what to do when a user selects @N from a
# provider table. The CLI uses this to auto-insert stages (e.g. download-file)
@@ -149,6 +150,36 @@ class Provider(ABC):
or self.__class__.__name__
).lower()
@property
def preserve_order(self) -> bool:
"""True if search result order is significant and should be preserved in displays."""
return False
def get_table_type(self, query: str, filters: Optional[Dict[str, Any]] = None) -> str:
"""Return the table type identifier for results from this provider."""
return self.name
def get_table_title(self, query: str, filters: Optional[Dict[str, Any]] = None) -> str:
"""Return a descriptive title for the results table."""
q = str(query or "").strip() or "*"
return f"{self.label}: {q}"
def get_table_metadata(self, query: str, filters: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
"""Return metadata for the results table."""
return {"provider": self.name}
def get_source_command(self, args_list: List[str]) -> Tuple[str, List[str]]:
"""Return the command and arguments that produced this search result.
Used for @N expansion to re-run the search if needed.
"""
return "search-file", list(args_list)
@property
def prefers_transfer_progress(self) -> bool:
"""True if this provider prefers explicit transfer progress tracking (begin/finish) during download."""
return False
@classmethod
def config_schema(cls) -> List[Dict[str, Any]]:
"""Return configuration schema for this provider.