fix(elvish): prepend asdf paths to $PATH (#1174)

* fix(elvish): prepend asdf paths to `$PATH`
* refactor(elvish): minor improvements
This commit is contained in:
cherryblossom000 2022-03-01 00:58:18 +11:00 committed by GitHub
parent e0d27e6c3c
commit 682b7a1d6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,8 @@
use path
use re use re
use str use str
use path
var asdf_dir = $E:HOME'/.asdf' var asdf_dir = ~'/.asdf'
if (and (has-env ASDF_DIR) (!=s $E:ASDF_DIR '')) { if (and (has-env ASDF_DIR) (!=s $E:ASDF_DIR '')) {
set asdf_dir = $E:ASDF_DIR set asdf_dir = $E:ASDF_DIR
} else { } else {
@ -32,7 +31,7 @@ fn asdf {|command @args|
} }
fn match {|argz @pats| fn match {|argz @pats|
var matched = $true; var matched = $true
if (!= (count $argz) (count $pats)) { if (!= (count $argz) (count $pats)) {
set matched = $false set matched = $false
} else { } else {
@ -88,8 +87,8 @@ for path [
] { ] {
if (not (has-value $paths $path)) { if (not (has-value $paths $path)) {
set paths = [ set paths = [
$@paths
$path $path
$@paths
] ]
} }
} }