diff options
Diffstat (limited to 'crates/turtle/src/main.rs')
| -rw-r--r-- | crates/turtle/src/main.rs | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/crates/turtle/src/main.rs b/crates/turtle/src/main.rs new file mode 100644 index 00000000..e5b80ee8 --- /dev/null +++ b/crates/turtle/src/main.rs @@ -0,0 +1,73 @@ +#![warn(clippy::pedantic, clippy::nursery)] +#![allow(clippy::use_self, clippy::missing_const_for_fn)] // not 100% reliable +// #![deny(unsafe_code)] +#![forbid(unsafe_code)] + +use clap::Parser; +use clap::builder::Styles; +use clap::builder::styling::{AnsiColor, Effects}; +use eyre::Result; + +use command::AtuinCmd; + +mod command; + +mod atuin_client; +mod atuin_common; +mod atuin_daemon; +mod atuin_history; +mod atuin_pty_proxy; +mod atuin_server; +mod atuin_server_database; +mod atuin_server_postgres; +mod atuin_server_sqlite; + +#[cfg(feature = "sync")] +mod print_error; +#[cfg(feature = "sync")] +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() +} |
