Pārlūkot izejas kodu

Add rbenv-whence to show you which versions of Ruby have a given command

pull/360/head^2
Sam Stephenson pirms 15 gadiem
vecāks
revīzija
d257b562e5
1 mainītis faili ar 22 papildinājumiem un 0 dzēšanām
  1. +22
    -0
      libexec/rbenv-whence

+ 22
- 0
libexec/rbenv-whence Parādīt failu

@ -0,0 +1,22 @@
#!/usr/bin/env bash -e
if [ "$1" = "--path" ]; then
print_paths="1"
shift
else
print_paths=""
fi
whence() {
local command="$1"
rbenv-versions --bare | while read version; do
path="$(rbenv-prefix "$version")/bin/${command}"
if [ -x "$path" ]; then
[ "$print_paths" ] && echo "$path" || echo "$version"
fi
done
}
RBENV_COMMAND="$1"
result="$(whence "$RBENV_COMMAND")"
[ -n "$result" ] && echo "$result"

Notiek ielāde…
Atcelt
Saglabāt