From ab04ce5d77365e60987433068a59eb68f27f29ef Mon Sep 17 00:00:00 2001 From: sxyazi Date: Mon, 25 Nov 2024 23:29:31 +0800 Subject: [PATCH] fix: make `cd` expand variables regardless --- yazi-core/src/tab/commands/cd.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/yazi-core/src/tab/commands/cd.rs b/yazi-core/src/tab/commands/cd.rs index 69799cc2..69b59e29 100644 --- a/yazi-core/src/tab/commands/cd.rs +++ b/yazi-core/src/tab/commands/cd.rs @@ -17,17 +17,21 @@ struct Opt { impl From for Opt { fn from(mut c: Cmd) -> Self { - let mut target = c.take_first().and_then(Data::into_url).unwrap_or_default(); + Self { + interactive: c.bool("interactive"), + ..Self::from(c.take_first().and_then(Data::into_url).unwrap_or_default()) + } + } +} + +impl From for Opt { + fn from(mut target: Url) -> Self { if target.is_regular() { target = Url::from(expand_path(&target)); } - - Self { target, interactive: c.bool("interactive") } + Self { target, interactive: false } } } -impl From for Opt { - fn from(target: Url) -> Self { Self { target, interactive: false } } -} impl Tab { #[yazi_codegen::command]