mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 20:17:44 +02:00
Fix cd - (#5301)
This commit is contained in:
@ -531,13 +531,20 @@ pub fn eval_expression(
|
||||
})
|
||||
}
|
||||
Expr::Directory(s) => {
|
||||
let cwd = current_dir_str(engine_state, stack)?;
|
||||
let path = expand_path_with(s, cwd);
|
||||
if s == "-" {
|
||||
Ok(Value::String {
|
||||
val: "-".to_string(),
|
||||
span: expr.span,
|
||||
})
|
||||
} else {
|
||||
let cwd = current_dir_str(engine_state, stack)?;
|
||||
let path = expand_path_with(s, cwd);
|
||||
|
||||
Ok(Value::String {
|
||||
val: path.to_string_lossy().to_string(),
|
||||
span: expr.span,
|
||||
})
|
||||
Ok(Value::String {
|
||||
val: path.to_string_lossy().to_string(),
|
||||
span: expr.span,
|
||||
})
|
||||
}
|
||||
}
|
||||
Expr::GlobPattern(s) => {
|
||||
let cwd = current_dir_str(engine_state, stack)?;
|
||||
|
Reference in New Issue
Block a user