Allow to build atuin server without client (#404)

This commit is contained in:
Jakub Jirutka 2022-05-13 07:57:27 +02:00 committed by GitHub
parent 5e4e8d1152
commit 14b30606a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -33,13 +33,14 @@ members = ["./atuin-client", "./atuin-server", "./atuin-common"]
# TODO(conradludgate) # TODO(conradludgate)
# Currently, this keeps the same default built behaviour for v0.8 # Currently, this keeps the same default built behaviour for v0.8
# We should rethink this by the time we hit a new breaking change # We should rethink this by the time we hit a new breaking change
default = ["sync", "server"] default = ["client", "sync", "server"]
client = ["atuin-client"]
sync = ["atuin-client/sync"] sync = ["atuin-client/sync"]
server = ["atuin-server", "tracing-subscriber"] server = ["atuin-server", "tracing-subscriber"]
[dependencies] [dependencies]
atuin-server = { path = "atuin-server", version = "0.9.1", optional = true } atuin-server = { path = "atuin-server", version = "0.9.1", optional = true }
atuin-client = { path = "atuin-client", version = "0.9.1", default-features = false } atuin-client = { path = "atuin-client", version = "0.9.1", optional = true, default-features = false }
atuin-common = { path = "atuin-common", version = "0.9.1" } atuin-common = { path = "atuin-common", version = "0.9.1" }
log = "0.4" log = "0.4"

View file

@ -1,6 +1,7 @@
use clap::Subcommand; use clap::Subcommand;
use eyre::Result; use eyre::Result;
#[cfg(feature = "client")]
mod client; mod client;
#[cfg(feature = "server")] #[cfg(feature = "server")]
@ -9,6 +10,7 @@ mod server;
#[derive(Subcommand)] #[derive(Subcommand)]
#[clap(infer_subcommands = true)] #[clap(infer_subcommands = true)]
pub enum AtuinCmd { pub enum AtuinCmd {
#[cfg(feature = "client")]
#[clap(flatten)] #[clap(flatten)]
Client(client::Cmd), Client(client::Cmd),
@ -21,6 +23,7 @@ pub enum AtuinCmd {
impl AtuinCmd { impl AtuinCmd {
pub fn run(self) -> Result<()> { pub fn run(self) -> Result<()> {
match self { match self {
#[cfg(feature = "client")]
Self::Client(client) => client.run(), Self::Client(client) => client.run(),
#[cfg(feature = "server")] #[cfg(feature = "server")]
Self::Server(server) => server.run(), Self::Server(server) => server.run(),