From e8c841527880ac6ca47fd514ac70aad81764dae8 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Mon, 12 Sep 2022 20:19:22 +0100 Subject: update default layout (#523) * update layouts * add other duration changes * fmt :( --- src/command/client/history.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/command/client/history.rs') diff --git a/src/command/client/history.rs b/src/command/client/history.rs index 805fe4ca..fe5bfcbe 100644 --- a/src/command/client/history.rs +++ b/src/command/client/history.rs @@ -16,6 +16,8 @@ use atuin_client::{ #[cfg(feature = "sync")] use atuin_client::sync; +use super::search::format_duration; + #[derive(Subcommand)] #[clap(infer_subcommands = true)] pub enum Cmd { @@ -92,11 +94,7 @@ pub fn print_list(h: &[History], list_mode: ListMode) { #[allow(clippy::cast_sign_loss)] pub fn print_human_list(w: &mut StdoutLock, h: &[History]) { for h in h.iter().rev() { - let duration = - humantime::format_duration(Duration::from_nanos(std::cmp::max(h.duration, 0) as u64)) - .to_string(); - let duration: Vec<&str> = duration.split(' ').collect(); - let duration = duration[0]; + let duration = format_duration(Duration::from_nanos(std::cmp::max(h.duration, 0) as u64)); let time = h.timestamp.format("%Y-%m-%d %H:%M:%S"); let cmd = h.command.trim(); @@ -108,11 +106,7 @@ pub fn print_human_list(w: &mut StdoutLock, h: &[History]) { #[allow(clippy::cast_sign_loss)] pub fn print_regular(w: &mut StdoutLock, h: &[History]) { for h in h.iter().rev() { - let duration = - humantime::format_duration(Duration::from_nanos(std::cmp::max(h.duration, 0) as u64)) - .to_string(); - let duration: Vec<&str> = duration.split(' ').collect(); - let duration = duration[0]; + let duration = format_duration(Duration::from_nanos(std::cmp::max(h.duration, 0) as u64)); let time = h.timestamp.format("%Y-%m-%d %H:%M:%S"); let cmd = h.command.trim(); -- cgit v1.3.1