mirror of
https://github.com/pyenv/pyenv.git
synced 2025-02-18 21:31:29 +00:00
Merge pull request #1448 from rbenv/command-to-type-P
Ignore shell builtins and functions when looking up commands in PATH
This commit is contained in:
commit
41580b69db
5 changed files with 5 additions and 5 deletions
|
@ -99,7 +99,7 @@ case "$command" in
|
||||||
exec rbenv-help
|
exec rbenv-help
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
command_path="$(command -v "rbenv-$command" || true)"
|
command_path="$(type -P "rbenv-$command" || true)"
|
||||||
if [ -z "$command_path" ]; then
|
if [ -z "$command_path" ]; then
|
||||||
if [ "$command" == "shell" ]; then
|
if [ "$command" == "shell" ]; then
|
||||||
abort "shell integration not enabled. Run \`rbenv init' for instructions."
|
abort "shell integration not enabled. Run \`rbenv init' for instructions."
|
||||||
|
|
|
@ -15,7 +15,7 @@ if [ "$COMMAND" = "--complete" ]; then
|
||||||
exec rbenv-commands
|
exec rbenv-commands
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COMMAND_PATH="$(command -v "rbenv-$COMMAND" || command -v "rbenv-sh-$COMMAND")"
|
COMMAND_PATH="$(type -P "rbenv-$COMMAND" "rbenv-sh-$COMMAND" | head -n1)"
|
||||||
|
|
||||||
# --help is provided automatically
|
# --help is provided automatically
|
||||||
echo --help
|
echo --help
|
||||||
|
|
|
@ -23,7 +23,7 @@ fi
|
||||||
|
|
||||||
command_path() {
|
command_path() {
|
||||||
local command="$1"
|
local command="$1"
|
||||||
command -v rbenv-"$command" || command -v rbenv-sh-"$command" || true
|
type -P rbenv-"$command" rbenv-sh-"$command" | head -n1
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_initial_comment_block() {
|
extract_initial_comment_block() {
|
||||||
|
|
|
@ -47,7 +47,7 @@ root="${root%/*}"
|
||||||
|
|
||||||
rbenv_in_path=true
|
rbenv_in_path=true
|
||||||
if [ -n "$RBENV_ORIG_PATH" ]; then
|
if [ -n "$RBENV_ORIG_PATH" ]; then
|
||||||
PATH="$RBENV_ORIG_PATH" command -v rbenv >/dev/null || rbenv_in_path=""
|
PATH="$RBENV_ORIG_PATH" type -P rbenv >/dev/null || rbenv_in_path=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$print" ]; then
|
if [ -z "$print" ]; then
|
||||||
|
|
|
@ -38,7 +38,7 @@ remove_prototype_shim() {
|
||||||
# absolute path to the rbenv executable itself.
|
# absolute path to the rbenv executable itself.
|
||||||
rbenv_path() {
|
rbenv_path() {
|
||||||
local found
|
local found
|
||||||
found="$(PATH="$RBENV_ORIG_PATH" command -v rbenv)"
|
found="$(PATH="$RBENV_ORIG_PATH" type -P rbenv)"
|
||||||
if [[ $found == /* ]]; then
|
if [[ $found == /* ]]; then
|
||||||
echo "$found"
|
echo "$found"
|
||||||
elif [[ -n "$found" ]]; then
|
elif [[ -n "$found" ]]; then
|
||||||
|
|
Loading…
Reference in a new issue