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:
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!(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user