nushell: `path relative-to` does not like piping to its input
Describe the bug feature request
Important EDIT: from the help page of
path relative-to, it says The argument path needs to be a parent of the input path., but this issue of mine is more a feature request to relax this and compute the relative path to go from one to the other, regardless of parentness ๐
iโm not sure what to say more than the title really ๐
How to reproduce
- pipe
pwdtopath relative-to
> pwd | path relative-to $nu.home-path
documents/repos/github.com/amtoine/nushell
- give
pwdas the argument
> $nu.home-path | path relative-to (pwd)
Error: nu::shell::cant_convert
ร Can't convert to prefix not found.
โญโ[source:1:1]
1 โ nu
ยท โฒ
ยท โฐโโ can't convert string to prefix not found
โฐโโโโ
Expected behavior
i expected both the commands to give the same result and no error ๐
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.84.1 |
| branch | fix-expand-table-unnessary-color-in-trail-head-config |
| commit_hash | 9744418a2144a0bad7b8506f58a58cd5a40b8fdf |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.70.0 (90c541806 2023-05-31) |
| rust_channel | 1.70.0-x86_64-unknown-linux-gnu |
| cargo_version | cargo 1.70.0 (ec8a8a0ca 2023-04-25) |
| build_time | 2023-09-14 18:55:46 +02:00 |
| build_rust_channel | debug |
| allocator | standard |
| features | default, sqlite, trash, which, zip |
| installed_plugins | gstat, nu_plugin_explore |
Additional context
i also get other errors depending on the thing piped to path relative
> $env.HOME | path relative-to (pwd)
Error: nu::shell::cant_convert
ร Can't convert to prefix not found.
โญโ[Host Environment Variables:55:1]
55 โ "HISTFILE"="/home/amtoine/.local/state/bash/history"
56 โ "HOME"="/home/amtoine"
ยท โโโโโโโโฌโโโโโโโ
ยท โฐโโ can't convert string to prefix not found
57 โ "IPFS_PATH"="/home/amtoine/.ipfs"
โฐโโโโ
> "." | path relative-to (pwd)
Error: nu::shell::cant_convert
ร Can't convert to prefix not found.
โญโ[entry #13:1:1]
1 โ "." | path relative-to (pwd)
ยท โโฌโ
ยท โฐโโ can't convert string to prefix not found
โฐโโโโ
About this issue
- Original URL
- State: open
- Created 10 months ago
- Reactions: 1
- Comments: 17 (12 by maintainers)
okey, i see.
then, from the help page of the command
i think this is more of a feature request: i would vote for relaxing The argument path needs to be a parent of the input path. and just compute the absolute path from the input to the argument ๐
One way of making it work bidirectionally is just do:
ok, but how is it supposed to know when one is the prefix to strip?