mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
[ls, path relative-to] Fix use of ls ~ | path relative-to ~
(#5212)
* [ls] implement 1b. > `ls ~` does not return paths relative to the current directory. We now return `/Users/blah` instead of `../../blah` * expand lhs and rhs on `path relative-to` /Users/nimazzuc/projects/nushell〉'~' | path relative-to '~' /Users/nimazzuc/projects/nushell〉'~/foo' | path relative-to '~' foo /Users/nimazzuc/projects/nushell〉'/Users/nimazzuc/foo' | path relative-to '~' foo /Users/nimazzuc/projects/nushell〉'~/foo' | path relative-to '/Users/nimazzuc' foo * format
This commit is contained in:
@ -398,7 +398,7 @@ impl ExternalCommand {
|
||||
/// Spawn a command without shelling out to an external shell
|
||||
pub fn spawn_simple_command(&self, cwd: &str) -> Result<std::process::Command, ShellError> {
|
||||
let head = trim_enclosing_quotes(&self.name.item);
|
||||
let head = nu_path::expand_path_for_external_programs(head)
|
||||
let head = nu_path::expand_to_real_path(head)
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
|
||||
@ -409,7 +409,7 @@ impl ExternalCommand {
|
||||
item: trim_enclosing_quotes(&arg.item),
|
||||
span: arg.span,
|
||||
};
|
||||
arg.item = nu_path::expand_path_for_external_programs(arg.item)
|
||||
arg.item = nu_path::expand_to_real_path(arg.item)
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
|
||||
|
Reference in New Issue
Block a user