Adding strict mode to all of lib

This commit is contained in:
Victor Borja 2017-10-25 17:23:48 -05:00
parent a44ec2779a
commit d9f65187a1
22 changed files with 63 additions and 5 deletions

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
# shellcheck source=lib/utils.sh
source "$(dirname "$(dirname "$0")")/lib/utils.sh"

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
# shellcheck source=lib/utils.sh
source "$(dirname "$(dirname "$(dirname "$0")")")/lib/utils.sh"

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
plugin_current_command() {
local plugin_name=$1

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
help_command () {
echo "version: $(asdf_version)"
echo ""

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
handle_failure() {
local install_path="$1"
rm -rf "$install_path"

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
list_all_command() {
local plugin_name=$1
local plugin_path

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
list_command() {
local plugin_name=$1
check_if_plugin_exists "$plugin_name"

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
plugin_add_command() {
if [[ $# -lt 1 || $# -gt 2 ]]; then
display_error "usage: asdf plugin-add <name> [<git-url>]"

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
plugin_list_all_command() {
initialize_or_update_repository

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
plugin_list_command() {
local plugins_path
plugins_path=$(get_plugin_path)

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
plugin_push_command() {
local plugin_name=$1
if [ "$plugin_name" = "--all" ]; then

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
plugin_remove_command() {
local plugin_name=$1
check_if_plugin_exists "$plugin_name"

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
fail_test() {
echo "FAILED: $1"
rm -rf "$ASDF_DIR"

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
plugin_update_command() {
if [ "$#" -ne 1 ]; then
display_error "usage: asdf plugin-update {<name> | --all}"

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
shim_command() {
local plugin_name=$1
local executable_path=$2

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
uninstall_command() {
local plugin_name=$1
local full_version=$2

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
update_command() {
local update_to_head=$1

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
version_command() {
local cmd=$1
local plugin=$2

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
where_command() {
local plugin_name=$1
local full_version=$2

View File

@ -1,3 +1,6 @@
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
current_version() {
local plugin_name=$1

View File

@ -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
# here anytime asdf invokes grep it will be invoked with these options
# shellcheck disable=SC2034

View File

@ -1,11 +1,8 @@
#!/usr/bin/env bash
# Unoffical Bash "strict mode"
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
#ORIGINAL_IFS=$IFS
set -o nounset -o pipefail -o errexit
IFS=$'\t\n' # Stricter IFS settings
# shellcheck disable=SC2006
usage() {
cat <<EOF