feat: Make 'server' feature optional and add compile-time check
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
@@ -8,8 +8,8 @@ pub mod compression_engine;
|
||||
pub mod config;
|
||||
pub mod services;
|
||||
pub mod db;
|
||||
#[cfg(feature = "server")]
|
||||
pub mod meta_plugin;
|
||||
pub mod filter_plugin;
|
||||
pub mod modes;
|
||||
pub mod plugins;
|
||||
pub mod args;
|
||||
|
||||
15
src/main.rs
15
src/main.rs
@@ -1,4 +1,3 @@
|
||||
|
||||
use anyhow::{Context, Error, Result, anyhow};
|
||||
use clap::*;
|
||||
use clap::error::ErrorKind;
|
||||
@@ -203,7 +202,19 @@ fn main() -> Result<(), Error> {
|
||||
KeepModes::Info => modes::info::mode_info(&mut cmd, &settings, ids, tags, &mut conn, data_path),
|
||||
KeepModes::Status => modes::status::mode_status(&mut cmd, &settings, data_path, db_path),
|
||||
KeepModes::StatusPlugins => modes::status_plugins::mode_status_plugins(&mut cmd, &settings, data_path, db_path),
|
||||
KeepModes::Server => modes::server::mode_server(&mut cmd, &settings, &mut conn, data_path),
|
||||
KeepModes::Server => {
|
||||
#[cfg(feature = "server")]
|
||||
{
|
||||
modes::server::mode_server(&mut cmd, &settings, &mut conn, data_path)
|
||||
}
|
||||
#[cfg(not(feature = "server"))]
|
||||
{
|
||||
cmd.error(
|
||||
ErrorKind::MissingRequiredArgument,
|
||||
"This binary was not compiled with server support. Recompile with --features server"
|
||||
).exit();
|
||||
}
|
||||
},
|
||||
KeepModes::GenerateConfig => modes::generate_config::mode_generate_config(&mut cmd, &settings),
|
||||
KeepModes::Unknown => unreachable!(),
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#[cfg(feature = "server")]
|
||||
pub mod server;
|
||||
pub mod common;
|
||||
pub mod delete;
|
||||
pub mod diff;
|
||||
@@ -6,7 +8,6 @@ pub mod get;
|
||||
pub mod info;
|
||||
pub mod list;
|
||||
pub mod save;
|
||||
pub mod server;
|
||||
pub mod status;
|
||||
pub mod status_plugins;
|
||||
|
||||
@@ -18,6 +19,7 @@ pub use get::mode_get;
|
||||
pub use info::mode_info;
|
||||
pub use list::mode_list;
|
||||
pub use save::mode_save;
|
||||
#[cfg(feature = "server")]
|
||||
pub use server::mode_server;
|
||||
pub use status::mode_status;
|
||||
pub use status_plugins::mode_status_plugins;
|
||||
|
||||
Reference in New Issue
Block a user