aboutsummaryrefslogtreecommitdiffstats
path: root/src/local/history.rs
blob: 3c9a9069e70bb0cdea95c1f7683ecabb125ad335 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use chrono;
use uuid::Uuid;

#[derive(Debug)]
pub struct History {
    pub id: String,
    pub timestamp: i64,
    pub duration: i64,
    pub exit: i64,
    pub command: String,
    pub cwd: String,
}

impl History {
    pub fn new(command: String, cwd: String, exit: i64, duration: i64) -> History {
        History {
            id: Uuid::new_v4().to_simple().to_string(),
            timestamp: chrono::Utc::now().timestamp_millis(),
            command,
            cwd,
            exit,
            duration,
        }
    }
}