From 5c39e7cf284a1f6e9a1657f2deb44e359fc47eb8 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 11 Jun 2026 00:54:30 +0200 Subject: chore: Move everything into one big crate That helps remove duplicated code and rustc/cargo will now also show dead code correctly. --- crates/turtle/src/command/client/account.rs | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 crates/turtle/src/command/client/account.rs (limited to 'crates/turtle/src/command/client/account.rs') diff --git a/crates/turtle/src/command/client/account.rs b/crates/turtle/src/command/client/account.rs new file mode 100644 index 00000000..898f1ac4 --- /dev/null +++ b/crates/turtle/src/command/client/account.rs @@ -0,0 +1,47 @@ +use clap::{Args, Subcommand}; +use eyre::Result; + +use crate::atuin_client::record::sqlite_store::SqliteStore; +use crate::atuin_client::settings::Settings; + +pub mod change_password; +pub mod delete; +pub mod login; +pub mod logout; +pub mod register; + +#[derive(Args, Debug)] +pub struct Cmd { + #[command(subcommand)] + command: Commands, +} + +#[derive(Subcommand, Debug)] +pub enum Commands { + /// Login to the configured server + Login(login::Cmd), + + /// Register a new account + Register(register::Cmd), + + /// Log out + Logout, + + /// Delete your account, and all synced data + Delete(delete::Cmd), + + /// Change your password + ChangePassword(change_password::Cmd), +} + +impl Cmd { + pub async fn run(self, settings: Settings, store: SqliteStore) -> Result<()> { + match self.command { + Commands::Login(l) => l.run(&settings, &store).await, + Commands::Register(r) => r.run(&settings).await, + Commands::Logout => logout::run().await, + Commands::Delete(d) => d.run(&settings).await, + Commands::ChangePassword(c) => c.run(&settings).await, + } + } +} -- cgit v1.3.1