nushell/tests
Wind 87c5f6e455
ls, rm, cp, open, touch, mkdir: Don't expand tilde if input path is quoted string or a variable. (#12232)
# Description
Fixes:  #11887
Fixes: #11626

This pr unify the tilde expand behavior over several filesystem relative
commands. It follows the same rule with glob expansion:
|  command  |  result |
| ----------- |  ------ |
| ls ~/aaa  | expand tilde
| ls "~/aaa"  | don't expand tilde
| let f = "~/aaa"; ls $f | don't expand tilde, if you want to: use `ls
($f \| path expand)`
| let f: glob = "~/aaa"; ls $f | expand tilde, they don't expand on
`mkdir`, `touch` comamnd.

Actually I'm not sure for 4th item, currently it's expanding is just
because it followes the same rule with glob expansion.

### About the change
It changes `expand_path_with` to accept a new argument called
`expand_tilde`, if it's true, expand it, if not, just keep it as `~`
itself.

# User-Facing Changes
After this change, `ls "~/aaa"` won't expand tilde.

# Tests + Formatting
Done
2024-03-25 10:08:38 +08:00
..
assets/nu_json Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
const_ Fix const string interpolation test (#12038) 2024-03-01 16:35:07 -08:00
eval Exit early when encountering parsing errors (#10213) 2023-09-05 14:36:37 +02:00
fixtures Send LSP Completion Item Kind (#11443) 2024-03-24 20:14:12 -05:00
hooks Auto-expand table based on terminal width (#9934) 2023-08-08 05:47:23 -05:00
modules Evaluate string interpolation at parse time (#11562) 2024-01-22 09:13:48 +02:00
overlays Fix overlay_use_main_not_exported hanging when an external spam command exists (#11261) 2023-12-08 06:08:38 -06:00
parsing Fix: missing parse error when extra tokens are given to let bindings (#12238) 2024-03-21 10:37:52 -05:00
path ls, rm, cp, open, touch, mkdir: Don't expand tilde if input path is quoted string or a variable. (#12232) 2024-03-25 10:08:38 +08:00
plugin_persistence Merge stream_example into example plugin and clean up names (#12234) 2024-03-19 12:36:46 -05:00
plugins Merge stream_example into example plugin and clean up names (#12234) 2024-03-19 12:36:46 -05:00
scope add $.extra_usage to modules (#11649) 2024-01-27 17:49:21 +02:00
shell to json -r not removing whitespaces fix (#11948) 2024-03-20 22:14:31 +01:00
main.rs Keep plugins persistently running in the background (#12064) 2024-03-09 17:10:22 -06:00