elvish_config/aliases/which.elv

29 lines
538 B
Plaintext

fn -aliases {||
use re
use str
e:cat $E:HOME/.config/elvish/aliases/*.elv | e:rg '^edit:add-var' | re:awk {|_ _ alias @_|
str:replace '~' '' $alias
} | order
}
edit:add-var aliases~ {|| -aliases | each {|e| echo $e } }
edit:add-var which-all~ {|argv|
use framagit.org/benjamin.vaudour/elv-lib/mods/list
use path
use os
use str
if (-aliases | list:contains $argv) {
echo '(Alias)'
}
str:split ':' $E:PATH | each {|p|
var f = (path:join $p $argv)
if (os:is-regular $f) {
echo $f
}
}
}