aboutsummaryrefslogtreecommitdiff
path: root/src/date.rs
blob: e5d4ebd04277c3645e34f236dc0504491f704bdf (plain)
1
2
3
4
5
6
7
8
9
10
11
use std::process::Command;

pub fn fmt_date(ft: &str) -> String {
    let cmd = format!("date +\"{}\"", ft);
    let cmd = Command::new("sh").arg("-c").args(&[cmd]).output().unwrap();
    let result = String::from_utf8_lossy(&cmd.stdout)
        .to_string()
        .trim()
        .to_string();
    format!("    {}  │", result)
}