aboutsummaryrefslogtreecommitdiffstats
path: root/crates/client/src/main.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-09 21:43:23 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-09 21:43:23 +0200
commit3223d93cb3c77ab02aa0a35f2a8314e447cee9a4 (patch)
tree3971a1f37f5fe3cadb747c5229a0d54e868e45e3 /crates/client/src/main.rs
parentfix(client/sync): Pass through precise error on `SyncError::WrongKey` (diff)
downloadatuin-3223d93cb3c77ab02aa0a35f2a8314e447cee9a4.zip
chore: Separate daemon, client, server, and lib into crates
Diffstat (limited to 'crates/client/src/main.rs')
-rw-r--r--crates/client/src/main.rs76
1 files changed, 76 insertions, 0 deletions
diff --git a/crates/client/src/main.rs b/crates/client/src/main.rs
new file mode 100644
index 00000000..12858140
--- /dev/null
+++ b/crates/client/src/main.rs
@@ -0,0 +1,76 @@
+#![forbid(unsafe_code)]
+#![warn(clippy::pedantic, clippy::nursery, clippy::allow_attributes)]
+#![expect(
+ clippy::missing_const_for_fn, // not 100% reliable
+ clippy::redundant_pub_crate,
+)]
+#![expect(
+ clippy::cast_possible_wrap,
+ clippy::cast_sign_loss,
+ clippy::cast_possible_truncation,
+ reason = "We should remove all of these. But it's just a lot of work in this code-base"
+)]
+
+use clap::Parser;
+use clap::builder::Styles;
+use clap::builder::styling::{AnsiColor, Effects};
+use eyre::Result;
+
+use command::AtuinCmd;
+
+mod command;
+
+pub(crate) mod atuin_client;
+pub(crate) mod atuin_common;
+pub(crate) mod atuin_daemon;
+pub(crate) mod atuin_history;
+pub(crate) mod atuin_pty_proxy;
+pub(crate) mod atuin_server;
+
+mod print_error;
+mod sync;
+
+const VERSION: &str = env!("CARGO_PKG_VERSION");
+const SHA: &str = env!("GIT_HASH");
+
+const LONG_VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), " (", env!("GIT_HASH"), ")");
+
+static HELP_TEMPLATE: &str = "\
+{before-help}{name} {version}
+{author}
+{about}
+
+{usage-heading}
+ {usage}
+
+{all-args}{after-help}";
+
+const STYLES: Styles = Styles::styled()
+ .header(AnsiColor::Yellow.on_default().effects(Effects::BOLD))
+ .usage(AnsiColor::Green.on_default().effects(Effects::BOLD))
+ .literal(AnsiColor::Green.on_default().effects(Effects::BOLD))
+ .placeholder(AnsiColor::Green.on_default());
+
+/// Magical shell history
+#[derive(Parser)]
+#[command(
+ author = "Ellie Huxtable <ellie@atuin.sh>",
+ version = VERSION,
+ long_version = LONG_VERSION,
+ help_template(HELP_TEMPLATE),
+ styles = STYLES,
+)]
+struct Atuin {
+ #[command(subcommand)]
+ atuin: AtuinCmd,
+}
+
+impl Atuin {
+ fn run(self) -> Result<()> {
+ self.atuin.run()
+ }
+}
+
+fn main() -> Result<()> {
+ Atuin::parse().run()
+}