nushell/crates/nu-command/tests/commands/path
A. Taha Baki d25be66929
check existance w/o traversing symlinks (#10872)
# Description

Currently `path exists` checks the file/folder's existence by traversing
symlinks. I've added a `-n` switch/flag that disables symlink
traversing, similar to what `path expand -n` does.

## The Long Story (for those interested)

Hello! 👋 While working on one of my scripts, I discovered that the `path
exists` command was traversing symlinks. This meant that even if the
file existed, it would fail if the pointed location didn't exist. To
address this, I've introduced a new `-n` flag, which I borrowed from the
`path expand` command. This addition should make the behavior more
consistent within the *path commands universe*.

## But, is it any useful?
 
```nushell
let compat = /run/media/userX/DriveX/steam/steamapps/compatdata
if "symlink" == ($compat | path expand -n | path type) {}
# to this
if ($compat | path exists -n) {}
```

# User-Facing Changes

Users, will not efect. Unless they use the mentioned `-n` flag/switch.
2024-01-14 07:33:33 +08:00
..
basename.rs Add long options for path (#10775) 2023-10-19 22:07:01 +02:00
dirname.rs Add long options for path (#10775) 2023-10-19 22:07:01 +02:00
exists.rs check existance w/o traversing symlinks (#10872) 2024-01-14 07:33:33 +08:00
expand.rs Allow parse-time evaluation of calls, pipelines and subexpressions (#9499) 2023-08-26 16:41:29 +03:00
join.rs Allow parse-time evaluation of calls, pipelines and subexpressions (#9499) 2023-08-26 16:41:29 +03:00
mod.rs remove warnings in nu_command tests (#10145) 2023-08-29 13:18:52 -07:00
parse.rs bump rust-toolchain to 1.72.1 (#11079) 2023-11-16 15:14:45 -06:00
split.rs Allow parse-time evaluation of calls, pipelines and subexpressions (#9499) 2023-08-26 16:41:29 +03:00
type_.rs Allow parse-time evaluation of calls, pipelines and subexpressions (#9499) 2023-08-26 16:41:29 +03:00