mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05: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
|
||||
;;
|
||||
* )
|
||||
command_path="$(command -v "rbenv-$command" || true)"
|
||||
command_path="$(type -P "rbenv-$command" || true)"
|
||||
if [ -z "$command_path" ]; then
|
||||
if [ "$command" == "shell" ]; then
|
||||
abort "shell integration not enabled. Run \`rbenv init' for instructions."
|
||||
|
|
|
@ -15,7 +15,7 @@ if [ "$COMMAND" = "--complete" ]; then
|
|||
exec rbenv-commands
|
||||
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
|
||||
echo --help
|
||||
|
|
|
@ -23,7 +23,7 @@ fi
|
|||
|
||||
command_path() {
|
||||
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() {
|
||||
|
|
|
@ -47,7 +47,7 @@ root="${root%/*}"
|
|||
|
||||
rbenv_in_path=true
|
||||
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
|
||||
|
||||
if [ -z "$print" ]; then
|
||||
|
|
|
@ -38,7 +38,7 @@ remove_prototype_shim() {
|
|||
# absolute path to the rbenv executable itself.
|
||||
rbenv_path() {
|
||||
local found
|
||||
found="$(PATH="$RBENV_ORIG_PATH" command -v rbenv)"
|
||||
found="$(PATH="$RBENV_ORIG_PATH" type -P rbenv)"
|
||||
if [[ $found == /* ]]; then
|
||||
echo "$found"
|
||||
elif [[ -n "$found" ]]; then
|
||||
|
|
Loading…
Reference in a new issue