feat: allow creating a tab with the startup directory when the tab_create command is called without specifying a path parameter (#917)

This commit is contained in:
三咲雅 · Misaki Masa 2024-04-15 16:16:09 +08:00 committed by GitHub
parent 280529c2cd
commit 4b04cb24b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,3 +1,4 @@
use yazi_boot::BOOT;
use yazi_proxy::AppProxy;
use yazi_shared::{event::Cmd, fs::Url, render};
@ -15,7 +16,10 @@ impl From<Cmd> for Opt {
if c.named.contains_key("current") {
Self { url: Default::default(), current: true }
} else {
Self { url: c.take_first().map_or_else(|| Url::from("."), Url::from), current: false }
Self {
url: c.take_first().map_or_else(|| Url::from(&BOOT.cwd), Url::from),
current: false,
}
}
}
}