fix: remove unused config parameter in mode functions
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -12,7 +12,6 @@ use is_terminal::IsTerminal;
|
||||
pub fn mode_get(
|
||||
cmd: &mut Command,
|
||||
settings: &config::Settings,
|
||||
_config: &config::Settings,
|
||||
ids: &mut Vec<i64>,
|
||||
tags: &mut Vec<String>,
|
||||
conn: &mut rusqlite::Connection,
|
||||
@@ -25,9 +24,12 @@ pub fn mode_get(
|
||||
}
|
||||
|
||||
let mut meta: std::collections::HashMap<String, String> = std::collections::HashMap::new();
|
||||
for item in settings.meta.iter() {
|
||||
let item = item.clone();
|
||||
meta.insert(item.key, item.value);
|
||||
// Collect metadata from environment variables
|
||||
for (key, value) in std::env::vars() {
|
||||
if key.starts_with("KEEP_META_") && key != "KEEP_META_PLUGINS" {
|
||||
let meta_name = key.strip_prefix("KEEP_META_").unwrap();
|
||||
meta.insert(meta_name.to_string(), value);
|
||||
}
|
||||
}
|
||||
|
||||
let item_maybe = match tags.is_empty() && meta.is_empty() {
|
||||
|
||||
@@ -21,7 +21,6 @@ use prettytable::{Attr, Cell, Row, Table};
|
||||
pub fn mode_info(
|
||||
cmd: &mut Command,
|
||||
settings: &config::Settings,
|
||||
_config: &config::Settings,
|
||||
ids: &mut Vec<i64>,
|
||||
tags: &mut Vec<String>,
|
||||
conn: &mut rusqlite::Connection,
|
||||
@@ -34,9 +33,12 @@ pub fn mode_info(
|
||||
}
|
||||
|
||||
let mut meta: std::collections::HashMap<String, String> = std::collections::HashMap::new();
|
||||
for item in settings.meta.iter() {
|
||||
let item = item.clone();
|
||||
meta.insert(item.key, item.value);
|
||||
// Collect metadata from environment variables
|
||||
for (key, value) in std::env::vars() {
|
||||
if key.starts_with("KEEP_META_") && key != "KEEP_META_PLUGINS" {
|
||||
let meta_name = key.strip_prefix("KEEP_META_").unwrap();
|
||||
meta.insert(meta_name.to_string(), value);
|
||||
}
|
||||
}
|
||||
|
||||
let item_maybe = match tags.is_empty() && meta.is_empty() {
|
||||
|
||||
@@ -29,7 +29,6 @@ struct ListItem {
|
||||
pub fn mode_list(
|
||||
cmd: &mut clap::Command,
|
||||
settings: &config::Settings,
|
||||
_config: &config::Config,
|
||||
ids: &mut Vec<i64>,
|
||||
tags: &Vec<String>,
|
||||
conn: &mut rusqlite::Connection,
|
||||
@@ -44,9 +43,12 @@ pub fn mode_list(
|
||||
}
|
||||
|
||||
let mut meta: std::collections::HashMap<String, String> = std::collections::HashMap::new();
|
||||
for item in settings.meta.iter() {
|
||||
let item = item.clone();
|
||||
meta.insert(item.key, item.value);
|
||||
// Collect metadata from environment variables
|
||||
for (key, value) in std::env::vars() {
|
||||
if key.starts_with("KEEP_META_") && key != "KEEP_META_PLUGINS" {
|
||||
let meta_name = key.strip_prefix("KEEP_META_").unwrap();
|
||||
meta.insert(meta_name.to_string(), value);
|
||||
}
|
||||
}
|
||||
|
||||
let items = match tags.is_empty() && meta.is_empty() {
|
||||
|
||||
@@ -139,10 +139,8 @@ fn collect_item_meta(settings: &config::Settings) -> std::collections::HashMap<S
|
||||
}
|
||||
}
|
||||
|
||||
for item in settings.meta.iter() {
|
||||
let item = item.clone();
|
||||
item_meta.insert(item.key, item.value);
|
||||
}
|
||||
// Add any additional metadata from settings if needed
|
||||
// (currently there's no direct metadata in settings, but this could be extended)
|
||||
|
||||
item_meta
|
||||
}
|
||||
@@ -232,7 +230,6 @@ fn finalize_meta_plugins(
|
||||
pub fn mode_save(
|
||||
cmd: &mut Command,
|
||||
settings: &config::Settings,
|
||||
_config: &config::Settings,
|
||||
ids: &mut Vec<i64>,
|
||||
tags: &mut Vec<String>,
|
||||
conn: &mut rusqlite::Connection,
|
||||
|
||||
@@ -3,7 +3,7 @@ use axum::{
|
||||
Router,
|
||||
};
|
||||
use clap::Command;
|
||||
use log::{debug, info, warn};
|
||||
use log::{debug, info};
|
||||
use std::net::SocketAddr;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
@@ -22,23 +22,22 @@ pub use common::{ServerConfig, AppState, logging_middleware, create_auth_middlew
|
||||
pub fn mode_server(
|
||||
_cmd: &mut Command,
|
||||
settings: &config::Settings,
|
||||
config: &config::Settings,
|
||||
conn: &mut rusqlite::Connection,
|
||||
data_path: PathBuf,
|
||||
) -> Result<()> {
|
||||
// Get server address from args or config with default
|
||||
let server_address = if let Some(addr) = &settings.server_address {
|
||||
let server_address = if let Some(addr) = &settings.server_address() {
|
||||
addr.clone()
|
||||
} else if let Some(server_config) = &config.server {
|
||||
} else if let Some(server_config) = &settings.server {
|
||||
server_config.address.clone().unwrap_or_else(|| "127.0.0.1".to_string())
|
||||
} else {
|
||||
"127.0.0.1".to_string()
|
||||
};
|
||||
|
||||
// Get server port from args or config with default
|
||||
let server_port = if let Some(port) = settings.server_port {
|
||||
let server_port = if let Some(port) = settings.server_port() {
|
||||
port
|
||||
} else if let Some(server_config) = &config.server {
|
||||
} else if let Some(server_config) = &settings.server {
|
||||
server_config.port.unwrap_or(21080)
|
||||
} else {
|
||||
21080
|
||||
@@ -47,8 +46,8 @@ pub fn mode_server(
|
||||
let server_config = common::ServerConfig {
|
||||
address: server_address,
|
||||
port: Some(server_port),
|
||||
password: settings.server_password.clone(),
|
||||
password_hash: settings.server_password_hash.clone(),
|
||||
password: settings.server_password(),
|
||||
password_hash: settings.server_password_hash(),
|
||||
};
|
||||
|
||||
// We need to move the connection into the async runtime
|
||||
|
||||
@@ -123,7 +123,6 @@ fn build_meta_plugin_table(meta_plugin_info: &Vec<MetaPluginInfo>) -> Table {
|
||||
pub fn mode_status(
|
||||
_cmd: &mut Command,
|
||||
settings: &config::Settings,
|
||||
_config: &config::Settings,
|
||||
data_path: PathBuf,
|
||||
db_path: PathBuf,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
@@ -145,7 +144,7 @@ pub fn mode_status(
|
||||
}
|
||||
|
||||
// Determine which compression type would be enabled for a save operation
|
||||
let enabled_compression_type = if let Some(compression_name) = &settings.compression {
|
||||
let enabled_compression_type = if let Some(compression_name) = &settings.compression() {
|
||||
CompressionType::from_str(compression_name).ok()
|
||||
} else {
|
||||
Some(crate::compression_engine::default_compression_type())
|
||||
|
||||
@@ -15,7 +15,6 @@ use rusqlite::Connection;
|
||||
pub fn mode_update(
|
||||
cmd: &mut Command,
|
||||
settings: &config::Settings,
|
||||
_config: &config::Settings,
|
||||
ids: &mut Vec<i64>,
|
||||
tags: &mut Vec<String>,
|
||||
conn: &mut Connection,
|
||||
@@ -117,9 +116,6 @@ pub fn mode_update(
|
||||
}
|
||||
}
|
||||
|
||||
// Meta data is now in args.item.meta, not settings
|
||||
// This functionality seems to have been moved elsewhere or removed
|
||||
|
||||
// Commit the transaction
|
||||
tx.commit()?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user