2021-02-14 08:15:26 -07:00
|
|
|
#![warn(clippy::pedantic, clippy::nursery)]
|
2022-09-12 13:39:41 -06:00
|
|
|
#![allow(clippy::use_self, clippy::missing_const_for_fn)] // not 100% reliable
|
2021-02-14 06:28:01 -07:00
|
|
|
|
2022-10-18 02:50:22 -06:00
|
|
|
use clap::Parser;
|
2021-04-20 14:53:07 -06:00
|
|
|
use eyre::Result;
|
2020-10-04 17:59:28 -06:00
|
|
|
|
2021-02-14 10:18:02 -07:00
|
|
|
use command::AtuinCmd;
|
2021-02-13 12:37:00 -07:00
|
|
|
mod command;
|
2023-02-10 10:25:43 -07:00
|
|
|
mod tui;
|
2021-02-13 12:37:00 -07:00
|
|
|
|
2021-04-26 11:36:19 -06:00
|
|
|
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
|
|
|
|
2022-10-18 02:50:22 -06:00
|
|
|
static HELP_TEMPLATE: &str = "\
|
|
|
|
{before-help}{name} {version}
|
|
|
|
{author}
|
|
|
|
{about}
|
|
|
|
|
|
|
|
{usage-heading}
|
|
|
|
{usage}
|
|
|
|
|
|
|
|
{all-args}{after-help}";
|
|
|
|
|
2022-04-06 23:32:11 -06:00
|
|
|
/// Magical shell history
|
|
|
|
#[derive(Parser)]
|
2022-10-18 02:50:22 -06:00
|
|
|
#[command(
|
2020-10-05 10:20:48 -06:00
|
|
|
author = "Ellie Huxtable <e@elm.sh>",
|
2021-04-26 11:36:19 -06:00
|
|
|
version = VERSION,
|
2022-10-18 02:50:22 -06:00
|
|
|
help_template(HELP_TEMPLATE),
|
2020-10-05 04:52:03 -06:00
|
|
|
)]
|
2021-02-13 05:58:40 -07:00
|
|
|
struct Atuin {
|
2022-10-18 02:50:22 -06:00
|
|
|
#[command(subcommand)]
|
2021-02-13 05:58:40 -07:00
|
|
|
atuin: AtuinCmd,
|
2020-10-05 10:20:48 -06:00
|
|
|
}
|
|
|
|
|
2021-02-13 05:58:40 -07:00
|
|
|
impl Atuin {
|
2022-05-09 00:46:52 -06:00
|
|
|
fn run(self) -> Result<()> {
|
|
|
|
self.atuin.run()
|
2020-10-05 04:52:03 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-09 00:46:52 -06:00
|
|
|
fn main() -> Result<()> {
|
|
|
|
Atuin::parse().run()
|
2020-10-04 17:59:28 -06:00
|
|
|
}
|