diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-11-13 14:07:15 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-11-13 14:07:15 -0500 |
commit | f3d3aa2d2ae16d3ec33efed9b5c035ec3d523e0a (patch) | |
tree | c8f033e00bf6ba8d66b44cda31f6c01e7da770cf /src/history.rs | |
parent | d8ddced881672115f7dd7b7d5199190d5b80a60f (diff) | |
download | nbsh-f3d3aa2d2ae16d3ec33efed9b5c035ec3d523e0a.tar.gz nbsh-f3d3aa2d2ae16d3ec33efed9b5c035ec3d523e0a.zip |
clean up formatting a bit
Diffstat (limited to 'src/history.rs')
-rw-r--r-- | src/history.rs | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/history.rs b/src/history.rs index cca3114..908378f 100644 --- a/src/history.rs +++ b/src/history.rs @@ -1,7 +1,6 @@ use async_std::io::{ReadExt as _, WriteExt as _}; use futures_lite::future::FutureExt as _; use pty_process::Command as _; -use std::os::unix::process::ExitStatusExt as _; use textmode::Textmode as _; pub struct History { @@ -227,17 +226,9 @@ impl History { 0, ); if let Some(status) = entry.exit_status { - if let Some(sig) = status.signal() { - if let Some(name) = - signal_hook::low_level::signal_name(sig) - { - out.write_str(&format!("{} ", &name[3..])); - } else { - out.write_str(&format!("SIG{} ", sig)); - } - } else { - out.write_str(&format!("{} ", status.code().unwrap())); - } + out.write_str(&crate::format::exit_status(status)); + } else { + out.write_str(" "); } if focus == Some(idx) { out.set_fgcolor(textmode::color::BLACK); @@ -252,9 +243,9 @@ impl History { out.reset_attributes(); let time = if let Some(end_instant) = entry.end_instant { format!( - "[{} ({})]", + "[{} ({:6})]", entry.start_time.time().format("%H:%M:%S"), - crate::util::format_duration( + crate::format::duration( end_instant - entry.start_instant ) ) |