Never use HISTFILE for fish shell import (#573)

This commit is contained in:
Patrick Jackson 2022-10-19 03:57:51 -07:00 committed by GitHub
parent 540aa79054
commit 17c2e73388
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ use chrono::{prelude::*, Utc};
use directories::BaseDirs; use directories::BaseDirs;
use eyre::{eyre, Result}; use eyre::{eyre, Result};
use super::{get_histpath, unix_byte_lines, Importer, Loader}; use super::{unix_byte_lines, Importer, Loader};
use crate::history::History; use crate::history::History;
#[derive(Debug)] #[derive(Debug)]
@ -36,7 +36,7 @@ fn default_histpath() -> Result<PathBuf> {
if histpath.exists() { if histpath.exists() {
Ok(histpath) Ok(histpath)
} else { } else {
Err(eyre!("Could not find history file. Try setting $HISTFILE")) Err(eyre!("Could not find history file."))
} }
} }
@ -46,8 +46,7 @@ impl Importer for Fish {
async fn new() -> Result<Self> { async fn new() -> Result<Self> {
let mut bytes = Vec::new(); let mut bytes = Vec::new();
let path = get_histpath(default_histpath)?; let mut f = File::open(default_histpath()?)?;
let mut f = File::open(path)?;
f.read_to_end(&mut bytes)?; f.read_to_end(&mut bytes)?;
Ok(Self { bytes }) Ok(Self { bytes })
} }