From bae59474eef3fd28758a2a4e5e4fb8d50c93a3c4 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Sun, 14 Feb 2021 18:00:41 +0000 Subject: a few more tiny touch ups (#7) * a few more tiny touch ups * all praise clippy --- src/main.rs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 2dbeabfe..21241b83 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,6 @@ use std::path::PathBuf; use directories::ProjectDirs; use eyre::{eyre, Result}; use structopt::StructOpt; -use uuid::Uuid; #[macro_use] extern crate log; @@ -46,26 +45,17 @@ impl Atuin { let path = shellexpand::full(path)?; PathBuf::from(path.as_ref()) } else { - let project_dirs = - ProjectDirs::from("com", "elliehuxtable", "atuin").ok_or_else(|| { + ProjectDirs::from("com", "elliehuxtable", "atuin") + .ok_or_else(|| { eyre!("could not determine db file location\nspecify one using the --db flag") - })?; - let root = project_dirs.data_dir(); - root.join("history.db") + })? + .data_dir() + .join("history.db") }; let mut db = Sqlite::new(db_path)?; - match self.atuin { - AtuinCmd::History(history) => history.run(&mut db), - AtuinCmd::Import(import) => import.run(&mut db), - AtuinCmd::Server(server) => server.run(), - - AtuinCmd::Uuid => { - println!("{}", Uuid::new_v4().to_simple().to_string()); - Ok(()) - } - } + self.atuin.run(&mut db) } } -- cgit v1.3.1