aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/command/client/daemon.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/turtle/src/command/client/daemon.rs')
-rw-r--r--crates/turtle/src/command/client/daemon.rs36
1 files changed, 13 insertions, 23 deletions
diff --git a/crates/turtle/src/command/client/daemon.rs b/crates/turtle/src/command/client/daemon.rs
index cb5dd118..41cb04fe 100644
--- a/crates/turtle/src/command/client/daemon.rs
+++ b/crates/turtle/src/command/client/daemon.rs
@@ -22,16 +22,8 @@ use tokio::time::sleep;
#[derive(clap::Args, Debug)]
pub(crate) struct Cmd {
- /// Internal flag for daemonization
- #[arg(long, hide = true)]
- daemonize: bool,
-
- /// Also write daemon logs to the console (useful for debugging)
- #[arg(long)]
- show_logs: bool,
-
#[command(subcommand)]
- subcmd: Option<SubCmd>,
+ subcmd: SubCmd,
}
#[derive(Subcommand, Debug)]
@@ -67,8 +59,7 @@ impl Cmd {
#[cfg(unix)]
pub(crate) fn should_daemonize(&self) -> bool {
match &self.subcmd {
- Some(SubCmd::Start { daemonize, .. }) => *daemonize,
- None => self.daemonize,
+ SubCmd::Start { daemonize, .. } => *daemonize,
_ => false,
}
}
@@ -76,8 +67,7 @@ impl Cmd {
/// Returns `true` when logs should also be written to the console.
pub(crate) fn show_logs(&self) -> bool {
match &self.subcmd {
- Some(SubCmd::Start { show_logs, .. }) => *show_logs,
- None => self.show_logs,
+ SubCmd::Start { show_logs, .. } => *show_logs,
_ => false,
}
}
@@ -89,14 +79,10 @@ impl Cmd {
history_db: ClientSqlite,
) -> Result<()> {
match self.subcmd {
- None => {
- eprintln!("Warning: `atuin daemon` is deprecated, use `atuin daemon start`");
- run(settings, store, history_db, false).await
- }
- Some(SubCmd::Start { force, .. }) => run(settings, store, history_db, force).await,
- Some(SubCmd::Status) => status_cmd(&settings).await,
- Some(SubCmd::Stop) => stop_cmd(&settings).await,
- Some(SubCmd::Restart) => restart_cmd(&settings).await,
+ SubCmd::Start { force, .. } => run(settings, store, history_db, force).await,
+ SubCmd::Status => status_cmd(&settings).await,
+ SubCmd::Stop => stop_cmd(&settings).await,
+ SubCmd::Restart => restart_cmd(&settings).await,
}
}
}
@@ -331,7 +317,6 @@ async fn wait_until_ready(settings: &Settings, timeout: Duration) -> Result<Hist
}
}
-#[expect(clippy::unnecessary_wraps)]
fn ensure_autostart_supported(settings: &Settings) -> Result<()> {
#[cfg(unix)]
if settings.daemon.systemd_socket {
@@ -438,7 +423,12 @@ pub(crate) async fn start_history(settings: &Settings, history: History) -> Resu
Ok(resp.id)
}
-pub(crate) async fn end_history(settings: &Settings, id: String, duration: u64, exit: i64) -> Result<()> {
+pub(crate) async fn end_history(
+ settings: &Settings,
+ id: String,
+ duration: u64,
+ exit: i64,
+) -> Result<()> {
match async {
connect_client(settings)
.await?