fix: Correct Pest grammar and update ItemService initialization
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
@@ -396,6 +396,29 @@ impl Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Get server password from password_file or directly from config if configured
|
||||||
|
pub fn get_server_password(&self) -> Result<Option<String>> {
|
||||||
|
if let Some(server) = &self.server {
|
||||||
|
// First check for password_file
|
||||||
|
if let Some(password_file) = &server.password_file {
|
||||||
|
debug!("CONFIG: Reading password from file: {:?}", password_file);
|
||||||
|
let password = fs::read_to_string(password_file)
|
||||||
|
.with_context(|| format!("Failed to read password file: {:?}", password_file))?
|
||||||
|
.trim()
|
||||||
|
.to_string();
|
||||||
|
return Ok(Some(password));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall back to direct password field
|
||||||
|
if let Some(password) = &server.password {
|
||||||
|
debug!("CONFIG: Using password from config");
|
||||||
|
return Ok(Some(password.clone()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Get server password from password_file or directly from config if configured
|
/// Get server password from password_file or directly from config if configured
|
||||||
pub fn get_server_password(&self) -> Result<Option<String>> {
|
pub fn get_server_password(&self) -> Result<Option<String>> {
|
||||||
if let Some(server) = &self.server {
|
if let Some(server) = &self.server {
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ pub fn mode_diff(
|
|||||||
|
|
||||||
let settings = crate::config::Settings::new(args, crate::config::default_dir()?)?;
|
let settings = crate::config::Settings::new(args, crate::config::default_dir()?)?;
|
||||||
|
|
||||||
let item_service = crate::services::item_service::ItemService::new(&settings)?;
|
let item_service = crate::services::item_service::ItemService::new(settings.dir.clone());
|
||||||
|
|
||||||
let (item_a, item_b) = fetch_and_validate_items(conn, &ids, &item_service)?;
|
let (item_a, item_b) = fetch_and_validate_items(conn, &ids, &item_service)?;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
WHITESPACE = _{ " " | "\t" | "\n" | "\r" }
|
WHITESPACE = _{ " " | "\t" | "\n" | "\r" }
|
||||||
|
|
||||||
// This Pest grammar defines the syntax for filter chains used in the Keep application.
|
//! This Pest grammar defines the syntax for filter chains used in the Keep application.
|
||||||
|
|
||||||
// Main entry point for parsing multiple filters separated by pipes
|
// Main entry point for parsing multiple filters separated by pipes
|
||||||
filters = { SOI ~ filter ~ (pipe ~ filter)* ~ EOI }
|
filters = { SOI ~ filter ~ (pipe ~ filter)* ~ EOI }
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ use std::collections::HashMap;
|
|||||||
#[grammar = "filter.pest"]
|
#[grammar = "filter.pest"]
|
||||||
pub struct FilterParser;
|
pub struct FilterParser;
|
||||||
|
|
||||||
|
use self::Rule;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Filter {
|
pub struct Filter {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user