2020-10-04 17:59:28 -06:00
|
|
|
use chrono;
|
2021-02-13 10:02:52 -07:00
|
|
|
use uuid::Uuid;
|
2020-10-04 17:59:28 -06:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct History {
|
2021-02-13 10:02:52 -07:00
|
|
|
pub id: String,
|
2020-10-04 17:59:28 -06:00
|
|
|
pub timestamp: i64,
|
2021-02-13 10:02:52 -07:00
|
|
|
pub duration: i64,
|
|
|
|
pub exit: i64,
|
2020-10-04 17:59:28 -06:00
|
|
|
pub command: String,
|
|
|
|
pub cwd: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl History {
|
2021-02-13 10:02:52 -07:00
|
|
|
pub fn new(command: String, cwd: String, exit: i64, duration: i64) -> History {
|
2020-10-04 17:59:28 -06:00
|
|
|
History {
|
2021-02-13 10:02:52 -07:00
|
|
|
id: Uuid::new_v4().to_simple().to_string(),
|
2020-10-04 17:59:28 -06:00
|
|
|
timestamp: chrono::Utc::now().timestamp_millis(),
|
2020-10-05 10:20:48 -06:00
|
|
|
command,
|
|
|
|
cwd,
|
2021-02-13 10:02:52 -07:00
|
|
|
exit,
|
|
|
|
duration,
|
2020-10-04 17:59:28 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|