atuin/src/local/history.rs

26 lines
533 B
Rust
Raw Normal View History

use chrono;
2021-02-13 10:02:52 -07:00
use uuid::Uuid;
#[derive(Debug)]
pub struct History {
2021-02-13 10:02:52 -07:00
pub id: String,
pub timestamp: i64,
2021-02-13 10:02:52 -07:00
pub duration: i64,
pub exit: i64,
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 {
History {
2021-02-13 10:02:52 -07:00
id: Uuid::new_v4().to_simple().to_string(),
timestamp: chrono::Utc::now().timestamp_millis(),
command,
cwd,
2021-02-13 10:02:52 -07:00
exit,
duration,
}
}
}