Skip to main content

otto_cli/output/
mod.rs

1mod history;
2mod style;
3mod tasks;
4
5pub use history::{HistoryRow, print_history};
6pub use style::{
7    accent, bold, bullet, command, configure, failure, info, muted, number, success, warning,
8};
9pub use tasks::{TaskRow, print_tasks};
10
11pub fn format_duration_ms(ms: i64) -> String {
12    if ms < 1000 {
13        return format!("{ms}ms");
14    }
15
16    if ms.rem_euclid(1000) == 0 {
17        return format!("{}s", ms / 1000);
18    }
19
20    format!("{:.3}s", ms as f64 / 1000.0)
21}