mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
feat(hooks): add rusty-paths.nu
(#596)
This commit is contained in:
parent
0dd97178ad
commit
51cc782344
1 changed files with 25 additions and 0 deletions
25
hooks/rusty-paths/rusty-paths.nu
Normal file
25
hooks/rusty-paths/rusty-paths.nu
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Description
|
||||
#
|
||||
# Include `target/debug` and `target/release` in `$env.PATH`
|
||||
# while `cd`-ing into a Rust project (assumed existence of `Cargo.lock`)
|
||||
#
|
||||
#
|
||||
# Installation
|
||||
#
|
||||
# 1. Move this file under any directory in `$env.NU_LIB_DIRS`
|
||||
# 2. Add `source rusty-paths.nu` to `$nu.config-path`
|
||||
|
||||
|
||||
$env.config = ($env.config | update hooks.env_change.PWD {
|
||||
append {
|
||||
condition: {|_, after| ($after | path join 'Cargo.lock' | path exists) }
|
||||
code: {
|
||||
$env.PATH = (
|
||||
$env.PATH
|
||||
| prepend ($env.PWD | path join 'target/debug')
|
||||
| prepend ($env.PWD | path join 'target/release')
|
||||
| uniq
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue