mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2025-01-27 00:58:31 +00:00
Add DeepSource
This commit is contained in:
parent
3483ab013a
commit
21211e43d1
@ -31,17 +31,15 @@ fn import_autojump(db: &mut Database, buffer: &str) -> Result<()> {
|
||||
if line.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let mut split = line.splitn(2, '\t');
|
||||
let (rank, path) =
|
||||
line.split_once('\t').with_context(|| format!("invalid entry: {line}"))?;
|
||||
|
||||
let rank = split.next().with_context(|| format!("invalid entry: {line}"))?;
|
||||
let mut rank = rank.parse::<f64>().with_context(|| format!("invalid rank: {rank}"))?;
|
||||
// Normalize the rank using a sigmoid function. Don't import actual ranks from
|
||||
// autojump, since its scoring algorithm is very different and might
|
||||
// take a while to get normalized.
|
||||
rank = sigmoid(rank);
|
||||
|
||||
let path = split.next().with_context(|| format!("invalid entry: {line}"))?;
|
||||
|
||||
db.add_unchecked(path, rank, 0);
|
||||
}
|
||||
|
||||
|
@ -96,13 +96,11 @@ mod tests {
|
||||
#[apply(opts)]
|
||||
fn elvish_elvish(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
|
||||
let opts = Opts { cmd, hook, echo, resolve_symlinks };
|
||||
let mut source = String::new();
|
||||
let mut source = String::default();
|
||||
|
||||
// Filter out lines using edit:*, since those functions are only available in
|
||||
// the interactive editor.
|
||||
for line in
|
||||
Elvish(&opts).render().unwrap().split('\n').filter(|line| !line.contains("edit:"))
|
||||
{
|
||||
for line in Elvish(&opts).render().unwrap().lines().filter(|line| !line.contains("edit:")) {
|
||||
source.push_str(line);
|
||||
source.push('\n');
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ impl FzfChild {
|
||||
mem::drop(self.0.stdin.take());
|
||||
|
||||
let mut stdout = self.0.stdout.take().unwrap();
|
||||
let mut output = String::new();
|
||||
let mut output = String::default();
|
||||
stdout.read_to_string(&mut output).context("failed to read from fzf")?;
|
||||
|
||||
let status = self.0.wait().context("wait failed on fzf")?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user