Skip to content

Commit

Permalink
fix: make cd expand variables regardless
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Nov 25, 2024
1 parent 4026ceb commit ab04ce5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions yazi-core/src/tab/commands/cd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ struct Opt {

impl From<Cmd> for Opt {
fn from(mut c: Cmd) -> Self {
let mut target = c.take_first().and_then(Data::into_url).unwrap_or_default();
if target.is_regular() {
target = Url::from(expand_path(&target));
Self {
interactive: c.bool("interactive"),
..Self::from(c.take_first().and_then(Data::into_url).unwrap_or_default())
}

Self { target, interactive: c.bool("interactive") }
}
}

impl From<Url> for Opt {
fn from(target: Url) -> Self { Self { target, interactive: false } }
fn from(mut target: Url) -> Self {
if target.is_regular() {
target = Url::from(expand_path(&target));
}
Self { target, interactive: false }
}
}

impl Tab {
Expand Down

0 comments on commit ab04ce5

Please sign in to comment.