mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Don't allow unset variables
This commit is contained in:
parent
86537d2a6d
commit
03f2fb7e4c
1
bin/asdf
1
bin/asdf
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o nounset
|
||||
|
||||
# shellcheck source=lib/utils.bash
|
||||
. "$(dirname "$(dirname "$0")")/lib/utils.bash"
|
||||
|
@ -1,11 +1,13 @@
|
||||
# -*- sh -*-
|
||||
set -o nounset
|
||||
|
||||
# shellcheck source=lib/functions/plugins.bash
|
||||
. "$(dirname "$(dirname "$0")")/lib/functions/plugins.bash"
|
||||
|
||||
# shellcheck disable=SC2059
|
||||
plugin_current_command() {
|
||||
local plugin_name=$1
|
||||
local terminal_format=$2
|
||||
local plugin_name=${1:-}
|
||||
local terminal_format=${2:-}
|
||||
|
||||
check_if_plugin_exists "$plugin_name"
|
||||
|
||||
@ -21,7 +23,7 @@ plugin_current_command() {
|
||||
local description=""
|
||||
|
||||
IFS=' ' read -r -a versions <<<"$full_version"
|
||||
for version in "${versions[@]}"; do
|
||||
for version in "${versions[@]:-}"; do
|
||||
if ! (check_if_version_exists "$plugin_name" "$version"); then
|
||||
version_not_installed="$version"
|
||||
fi
|
||||
|
@ -139,7 +139,7 @@ version_not_installed_text() {
|
||||
}
|
||||
|
||||
get_plugin_path() {
|
||||
if test -n "$1"; then
|
||||
if test -n "${1:-}"; then
|
||||
printf "%s\\n" "$(asdf_data_dir)/plugins/$1"
|
||||
else
|
||||
printf "%s\\n" "$(asdf_data_dir)/plugins"
|
||||
@ -212,7 +212,7 @@ find_versions() {
|
||||
|
||||
get_version_in_dir "$plugin_name" "$HOME" "$legacy_filenames"
|
||||
|
||||
if [ -f "$ASDF_DEFAULT_TOOL_VERSIONS_FILENAME" ]; then
|
||||
if [ -f "${ASDF_DEFAULT_TOOL_VERSIONS_FILENAME:-}" ]; then
|
||||
versions=$(parse_asdf_version_file "$ASDF_DEFAULT_TOOL_VERSIONS_FILENAME" "$plugin_name")
|
||||
if [ -n "$versions" ]; then
|
||||
printf "%s\\n" "$versions|$ASDF_DEFAULT_TOOL_VERSIONS_FILENAME"
|
||||
@ -244,21 +244,21 @@ find_install_path() {
|
||||
|
||||
if [ "$version" = "system" ]; then
|
||||
printf "\\n"
|
||||
elif [ "${version_info[0]}" = "ref" ]; then
|
||||
elif [ "${version_info[0]:-}" = "ref" ]; then
|
||||
local install_type="${version_info[0]}"
|
||||
local version="${version_info[1]}"
|
||||
get_install_path "$plugin_name" "$install_type" "$version"
|
||||
elif [ "${version_info[0]}" = "path" ]; then
|
||||
elif [ "${version_info[0]:-}" = "path" ]; then
|
||||
# This is for people who have the local source already compiled
|
||||
# Like those who work on the language, etc
|
||||
# We'll allow specifying path:/foo/bar/project in .tool-versions
|
||||
# And then use the binaries there
|
||||
local install_type="path"
|
||||
local version="path"
|
||||
printf "%s\\n" "${version_info[1]}"
|
||||
printf "%s\\n" "${version_info[1]:-}"
|
||||
else
|
||||
local install_type="version"
|
||||
local version="${version_info[0]}"
|
||||
local version="${version_info[0]:-}"
|
||||
get_install_path "$plugin_name" "$install_type" "$version"
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user