feat: Add --filters option to --get and parse filters early
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -181,6 +181,23 @@ impl ItemService {
|
||||
conn: &Connection,
|
||||
id: i64,
|
||||
filter: Option<String>,
|
||||
) -> Result<(Box<dyn Read + Send>, String, bool), CoreError> {
|
||||
// Convert filter string to FilterChain if provided
|
||||
let filter_chain = if let Some(filter_str) = filter {
|
||||
self.filter_service.create_filter_chain(Some(&filter_str))
|
||||
.map_err(|e| CoreError::InvalidInput(format!("Failed to create filter chain: {}", e)))?
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
self.get_item_content_info_streaming_with_chain(conn, id, filter_chain)
|
||||
}
|
||||
|
||||
pub fn get_item_content_info_streaming_with_chain(
|
||||
&self,
|
||||
conn: &Connection,
|
||||
id: i64,
|
||||
filter_chain: Option<filter_plugin::FilterChain>,
|
||||
) -> Result<(Box<dyn Read + Send>, String, bool), CoreError> {
|
||||
let item_with_meta = self.get_item(conn, id)?;
|
||||
let item_id = item_with_meta.item.id.ok_or_else(|| CoreError::InvalidInput("Item missing ID".to_string()))?;
|
||||
@@ -197,10 +214,6 @@ impl ItemService {
|
||||
&item_with_meta.item.compression
|
||||
)?;
|
||||
|
||||
// Create filter chain
|
||||
let filter_chain = self.filter_service.create_filter_chain(filter.as_deref())
|
||||
.map_err(|e| CoreError::InvalidInput(format!("Failed to create filter chain: {}", e)))?;
|
||||
|
||||
// Wrap the reader with filtering
|
||||
let filtered_reader = Box::new(FilteringReader::new(reader, filter_chain));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user