1
0
Fork 0
mirror of https://github.com/icewind1991/zox synced 2026-06-03 10:24:06 +02:00

dont jump to home if not match

This commit is contained in:
Robin Appelman 2021-02-21 16:35:42 +01:00
commit 38f984d2de
2 changed files with 9 additions and 1 deletions

View file

@ -2,6 +2,7 @@ use main_error::MainError;
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::io::{stdout, Write};
use std::process::exit;
use std::time::{SystemTime, UNIX_EPOCH};
#[derive(Debug, Deserialize, Serialize)]
@ -237,6 +238,8 @@ fn main() -> Result<(), MainError> {
} else {
if let Some(first) = matches.first() {
println!("{}", first.path);
} else {
exit(1);
}
}
}

7
z.fish
View file

@ -3,5 +3,10 @@ function addzhist --on-variable PWD
end
function z -d "Jump to a recent directory."
cd (zox $argv)
set -l target (zox $argv)
if test $status -eq 0
cd $target
else
return $stats
end
end