mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Fix some issues reported by shellcheck
This commit is contained in:
parent
eda952ab08
commit
5f8a4c4d62
6 changed files with 15 additions and 11 deletions
|
@ -21,7 +21,8 @@ abort() {
|
|||
|
||||
if enable -f "${BASH_SOURCE%/*}"/../libexec/rbenv-realpath.dylib realpath 2>/dev/null; then
|
||||
abs_dirname() {
|
||||
local path="$(realpath "$1")"
|
||||
local path
|
||||
path="$(realpath "$1")"
|
||||
echo "${path%/*}"
|
||||
}
|
||||
else
|
||||
|
|
|
@ -28,15 +28,15 @@ shopt -s nullglob
|
|||
for command in "${path}/rbenv-"*; do
|
||||
command="${command##*rbenv-}"
|
||||
if [ -n "$sh" ]; then
|
||||
if [ ${command:0:3} = "sh-" ]; then
|
||||
echo ${command##sh-}
|
||||
if [ "${command:0:3}" = "sh-" ]; then
|
||||
echo "${command##sh-}"
|
||||
fi
|
||||
elif [ -n "$nosh" ]; then
|
||||
if [ ${command:0:3} != "sh-" ]; then
|
||||
echo ${command##sh-}
|
||||
if [ "${command:0:3}" != "sh-" ]; then
|
||||
echo "${command##sh-}"
|
||||
fi
|
||||
else
|
||||
echo ${command##sh-}
|
||||
echo "${command##sh-}"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
|
|
@ -42,6 +42,7 @@ extract_initial_comment_block() {
|
|||
}
|
||||
|
||||
collect_documentation() {
|
||||
# shellcheck disable=SC2016
|
||||
$(type -p gawk awk | head -1) '
|
||||
/^Summary:/ {
|
||||
summary = substr($0, 10)
|
||||
|
@ -86,7 +87,8 @@ collect_documentation() {
|
|||
}
|
||||
|
||||
documentation_for() {
|
||||
local filename="$(command_path "$1")"
|
||||
local filename
|
||||
filename="$(command_path "$1")"
|
||||
if [ -n "$filename" ]; then
|
||||
extract_initial_comment_block < "$filename" | collect_documentation
|
||||
fi
|
||||
|
@ -114,7 +116,7 @@ print_help() {
|
|||
eval "$(documentation_for "$command")"
|
||||
[ -n "$help" ] || help="$summary"
|
||||
|
||||
if [ -n "$usage" -o -n "$summary" ]; then
|
||||
if [ -n "$usage" ] || [ -n "$summary" ]; then
|
||||
if [ -n "$usage" ]; then
|
||||
echo "$usage"
|
||||
else
|
||||
|
|
|
@ -83,7 +83,7 @@ remove_outdated_shims() {
|
|||
list_executable_names() {
|
||||
local version file
|
||||
rbenv-versions --bare --skip-aliases | \
|
||||
while read version; do
|
||||
while read -r version; do
|
||||
for file in "${RBENV_ROOT}/versions/${version}/bin/"*; do
|
||||
echo "${file##*/}"
|
||||
done
|
||||
|
@ -136,6 +136,7 @@ shopt -s nullglob
|
|||
# executables.
|
||||
create_prototype_shim
|
||||
remove_outdated_shims
|
||||
# shellcheck disable=SC2046
|
||||
make_shims $(list_executable_names | sort -u)
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
# Summary: Display the root directory where versions and shims are kept
|
||||
echo $RBENV_ROOT
|
||||
echo "$RBENV_ROOT"
|
||||
|
|
|
@ -20,7 +20,7 @@ fi
|
|||
|
||||
whence() {
|
||||
local command="$1"
|
||||
rbenv-versions --bare | while read version; do
|
||||
rbenv-versions --bare | while read -r version; do
|
||||
path="$(rbenv-prefix "$version")/bin/${command}"
|
||||
if [ -x "$path" ]; then
|
||||
[ "$print_paths" ] && echo "$path" || echo "$version"
|
||||
|
|
Loading…
Reference in a new issue