diff options
| author | Conrad Ludgate <conradludgate@gmail.com> | 2022-09-12 20:19:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-12 20:19:22 +0100 |
| commit | e8c841527880ac6ca47fd514ac70aad81764dae8 (patch) | |
| tree | 577d51ad1e6e21b3a19359578f0de27f0522eebd /src/command/client/history.rs | |
| parent | better cursor search (#473) (diff) | |
| download | atuin-e8c841527880ac6ca47fd514ac70aad81764dae8.zip | |
update default layout (#523)
* update layouts
* add other duration changes
* fmt :(
Diffstat (limited to 'src/command/client/history.rs')
| -rw-r--r-- | src/command/client/history.rs | 14 |
1 files changed, 4 insertions, 10 deletions
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(); |
