Skip to content

Commit

Permalink
feat(console): left-align task IDs
Browse files Browse the repository at this point in the history
This looks somewhat nicer, IMO --- and, `top` and `htop` do this. It
would be nice to also left-align other numeric values (a la
`top`/`htop`), but we can't do that for `Duration`s currently, as the
`fmt::Debug` impl for `std::time::Duration` simply ignores alignment
specifiers (see rust-lang/rust#88059).

We could write our own custom formatter for durations, I guess...
  • Loading branch information
hawkw committed Aug 17, 2021
1 parent b2fff4d commit eccec83
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion console/src/view/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ impl List {
let task = task.borrow();
let is_terminated = task.completed_for() > 0;
let mut row = Row::new(vec![
Cell::from(id_width.update_str(task.id().to_string())),
Cell::from(id_width.update_str(format!(
"{:>width$}",
task.id(),
width = id_width.chars() as usize
))),
Cell::from(task.state().render(styles)),
dur_cell(task.total(now)),
dur_cell(task.busy(now)),
Expand Down

0 comments on commit eccec83

Please sign in to comment.