From 7b5c3d543d198a18884c990d540f5debc8a4d8d5 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Mon, 26 Apr 2021 11:50:31 +0100 Subject: Support bash, resolves #3 --- atuin-client/src/import/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 atuin-client/src/import/mod.rs (limited to 'atuin-client/src/import/mod.rs') diff --git a/atuin-client/src/import/mod.rs b/atuin-client/src/import/mod.rs new file mode 100644 index 00000000..3f8ea355 --- /dev/null +++ b/atuin-client/src/import/mod.rs @@ -0,0 +1,15 @@ +use std::fs::File; +use std::io::{BufRead, BufReader, Seek, SeekFrom}; + +use eyre::Result; + +pub mod bash; +pub mod zsh; + +// this could probably be sped up +fn count_lines(buf: &mut BufReader) -> Result { + let lines = buf.lines().count(); + buf.seek(SeekFrom::Start(0))?; + + Ok(lines) +} -- cgit v1.3.1