diff options
| author | Ellie Huxtable <e@elm.sh> | 2021-04-20 17:07:11 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-20 16:07:11 +0000 |
| commit | 34888827f8a06de835cbe5833a06914f28cce514 (patch) | |
| tree | 8b56f20e50065cd2c222d5e8e067ec55cf1947a1 /src/local/import.rs | |
| parent | Optimise docker (#34) (diff) | |
| download | atuin-34888827f8a06de835cbe5833a06914f28cce514.zip | |
Switch to Warp + SQLx, use async, switch to Rust stable (#36)
* Switch to warp + sql, use async and stable rust
* Update CI to use stable
Diffstat (limited to 'src/local/import.rs')
| -rw-r--r-- | src/local/import.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/local/import.rs b/src/local/import.rs index d0f679c9..3b0b2a69 100644 --- a/src/local/import.rs +++ b/src/local/import.rs @@ -7,6 +7,7 @@ use std::{fs::File, path::Path}; use chrono::prelude::*; use chrono::Utc; use eyre::{eyre, Result}; +use itertools::Itertools; use super::history::History; @@ -42,8 +43,8 @@ impl Zsh { fn parse_extended(line: &str, counter: i64) -> History { let line = line.replacen(": ", "", 2); - let (time, duration) = line.split_once(':').unwrap(); - let (duration, command) = duration.split_once(';').unwrap(); + let (time, duration) = line.splitn(2, ':').collect_tuple().unwrap(); + let (duration, command) = duration.splitn(2, ';').collect_tuple().unwrap(); let time = time .parse::<i64>() @@ -60,7 +61,7 @@ fn parse_extended(line: &str, counter: i64) -> History { time, command.trim_end().to_string(), String::from("unknown"), - -1, + 0, // assume 0, we have no way of knowing :( duration, None, None, |
