mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Adding strict mode to all of lib
This commit is contained in:
parent
a44ec2779a
commit
d9f65187a1
2
bin/asdf
2
bin/asdf
@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
# shellcheck source=lib/utils.sh
|
# shellcheck source=lib/utils.sh
|
||||||
source "$(dirname "$(dirname "$0")")/lib/utils.sh"
|
source "$(dirname "$(dirname "$0")")/lib/utils.sh"
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
# shellcheck source=lib/utils.sh
|
# shellcheck source=lib/utils.sh
|
||||||
source "$(dirname "$(dirname "$(dirname "$0")")")/lib/utils.sh"
|
source "$(dirname "$(dirname "$(dirname "$0")")")/lib/utils.sh"
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
plugin_current_command() {
|
plugin_current_command() {
|
||||||
local plugin_name=$1
|
local plugin_name=$1
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
help_command () {
|
help_command () {
|
||||||
echo "version: $(asdf_version)"
|
echo "version: $(asdf_version)"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
handle_failure() {
|
handle_failure() {
|
||||||
local install_path="$1"
|
local install_path="$1"
|
||||||
rm -rf "$install_path"
|
rm -rf "$install_path"
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
list_all_command() {
|
list_all_command() {
|
||||||
local plugin_name=$1
|
local plugin_name=$1
|
||||||
local plugin_path
|
local plugin_path
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
list_command() {
|
list_command() {
|
||||||
local plugin_name=$1
|
local plugin_name=$1
|
||||||
check_if_plugin_exists "$plugin_name"
|
check_if_plugin_exists "$plugin_name"
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
plugin_add_command() {
|
plugin_add_command() {
|
||||||
if [[ $# -lt 1 || $# -gt 2 ]]; then
|
if [[ $# -lt 1 || $# -gt 2 ]]; then
|
||||||
display_error "usage: asdf plugin-add <name> [<git-url>]"
|
display_error "usage: asdf plugin-add <name> [<git-url>]"
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
plugin_list_all_command() {
|
plugin_list_all_command() {
|
||||||
initialize_or_update_repository
|
initialize_or_update_repository
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
plugin_list_command() {
|
plugin_list_command() {
|
||||||
local plugins_path
|
local plugins_path
|
||||||
plugins_path=$(get_plugin_path)
|
plugins_path=$(get_plugin_path)
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
plugin_push_command() {
|
plugin_push_command() {
|
||||||
local plugin_name=$1
|
local plugin_name=$1
|
||||||
if [ "$plugin_name" = "--all" ]; then
|
if [ "$plugin_name" = "--all" ]; then
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
plugin_remove_command() {
|
plugin_remove_command() {
|
||||||
local plugin_name=$1
|
local plugin_name=$1
|
||||||
check_if_plugin_exists "$plugin_name"
|
check_if_plugin_exists "$plugin_name"
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
fail_test() {
|
fail_test() {
|
||||||
echo "FAILED: $1"
|
echo "FAILED: $1"
|
||||||
rm -rf "$ASDF_DIR"
|
rm -rf "$ASDF_DIR"
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
plugin_update_command() {
|
plugin_update_command() {
|
||||||
if [ "$#" -ne 1 ]; then
|
if [ "$#" -ne 1 ]; then
|
||||||
display_error "usage: asdf plugin-update {<name> | --all}"
|
display_error "usage: asdf plugin-update {<name> | --all}"
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
shim_command() {
|
shim_command() {
|
||||||
local plugin_name=$1
|
local plugin_name=$1
|
||||||
local executable_path=$2
|
local executable_path=$2
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
uninstall_command() {
|
uninstall_command() {
|
||||||
local plugin_name=$1
|
local plugin_name=$1
|
||||||
local full_version=$2
|
local full_version=$2
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
update_command() {
|
update_command() {
|
||||||
local update_to_head=$1
|
local update_to_head=$1
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
version_command() {
|
version_command() {
|
||||||
local cmd=$1
|
local cmd=$1
|
||||||
local plugin=$2
|
local plugin=$2
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
where_command() {
|
where_command() {
|
||||||
local plugin_name=$1
|
local plugin_name=$1
|
||||||
local full_version=$2
|
local full_version=$2
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
current_version() {
|
current_version() {
|
||||||
local plugin_name=$1
|
local plugin_name=$1
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
# We shouldn't rely on the user's grep settings to be correct. If we set these
|
# We shouldn't rely on the user's grep settings to be correct. If we set these
|
||||||
# here anytime asdf invokes grep it will be invoked with these options
|
# here anytime asdf invokes grep it will be invoked with these options
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -o nounset -o pipefail -o errexit
|
||||||
# Unoffical Bash "strict mode"
|
|
||||||
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
|
||||||
set -euo pipefail
|
|
||||||
#ORIGINAL_IFS=$IFS
|
|
||||||
IFS=$'\t\n' # Stricter IFS settings
|
IFS=$'\t\n' # Stricter IFS settings
|
||||||
|
|
||||||
|
|
||||||
# shellcheck disable=SC2006
|
# shellcheck disable=SC2006
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user