1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-07-30 13:47:46 +00:00

Fix error in non-home paths (#1129)

Before it would fail in paths outside the home directory with

```
 × Pipeline empty.
    ╭─[/home/filipp/.config/nushell/panache-git.nu:32:76]
 31 │   let current_dir_relative_to_home = (
 32 │     do --ignore-errors { $current_dir | path relative-to $nu.home-path } | str join
    ·                                                                            ────┬───
    ·                                                                                ╰── no input value was piped in
 33 │   )
    ╰────
```
This commit is contained in:
Filipp Samoilov 2025-06-09 14:09:18 +03:00 committed by GitHub
parent 6fe7713322
commit 2e39c27560
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,7 +29,7 @@ export def current-dir [] {
let current_dir = ($env.PWD)
let current_dir_relative_to_home = (
do --ignore-errors { $current_dir | path relative-to $nu.home-path } | str join
do --ignore-errors { $current_dir | path relative-to $nu.home-path | str join }
)
let in_sub_dir_of_home = ($current_dir_relative_to_home | is-not-empty)