use '-n', not '! -z', as per shellcheck SC2236

This commit is contained in:
joshr 2018-09-07 16:09:08 -04:00
parent f334b9bd34
commit 2383e1fe67
4 changed files with 8 additions and 8 deletions

View File

@ -8,7 +8,7 @@ if [[ "$GITSECRET_DIST" == "rpm" ]]; then
fi fi
# if not null GITSECRET_DIST # if not null GITSECRET_DIST
if [[ ! -z "$GITSECRET_DIST" ]]; then if [[ -n "$GITSECRET_DIST" ]]; then
# When making a non-container build, this step will generate # When making a non-container build, this step will generate
# proper manifest files: # proper manifest files:
make "deploy-$GITSECRET_DIST"; make "deploy-$GITSECRET_DIST";

View File

@ -454,13 +454,13 @@ function _find_and_clean_formatted {
local verbose=${2:-""} # can be empty or should be equal to "v" local verbose=${2:-""} # can be empty or should be equal to "v"
local message=${3:-"cleaning:"} # can be any string local message=${3:-"cleaning:"} # can be any string
if [[ ! -z "$verbose" ]]; then if [[ -n "$verbose" ]]; then
echo && echo "$message" echo && echo "$message"
fi fi
_find_and_clean "$pattern" "$verbose" _find_and_clean "$pattern" "$verbose"
if [[ ! -z "$verbose" ]]; then if [[ -n "$verbose" ]]; then
echo echo
fi fi
} }
@ -623,7 +623,7 @@ function _decrypt {
args+=( "--yes" ) args+=( "--yes" )
fi fi
if [[ ! -z "$homedir" ]]; then if [[ -n "$homedir" ]]; then
args+=( "--homedir" "$homedir" ) args+=( "--homedir" "$homedir" )
fi fi
@ -632,7 +632,7 @@ function _decrypt {
fi fi
local exit_code local exit_code
if [[ ! -z "$passphrase" ]]; then if [[ -n "$passphrase" ]]; then
echo "$passphrase" | $SECRETS_GPG_COMMAND "${args[@]}" --quiet --batch --yes --no-tty --passphrase-fd 0 \ echo "$passphrase" | $SECRETS_GPG_COMMAND "${args[@]}" --quiet --batch --yes --no-tty --passphrase-fd 0 \
"$encrypted_filename" "$encrypted_filename"
exit_code=$? exit_code=$?

View File

@ -44,7 +44,7 @@ function changes {
if [[ ! -f "$encrypted_filename" ]]; then if [[ ! -f "$encrypted_filename" ]]; then
_abort "cannot find encrypted version of file: $filename" _abort "cannot find encrypted version of file: $filename"
fi fi
if [[ ! -z "$normalized_path" ]]; then if [[ -n "$normalized_path" ]]; then
path=$(_append_root_path "$normalized_path") path=$(_append_root_path "$normalized_path")
else else
# Path was already normalized # Path was already normalized

View File

@ -34,7 +34,7 @@ function _optional_delete {
path_mappings=$(_get_secrets_dir_paths_mapping) path_mappings=$(_get_secrets_dir_paths_mapping)
# We use custom formatting here: # We use custom formatting here:
if [[ ! -z "$verbose" ]]; then if [[ -n "$verbose" ]]; then
echo && echo 'removing unencrypted files:' echo && echo 'removing unencrypted files:'
fi fi
@ -45,7 +45,7 @@ function _optional_delete {
_find_and_clean "*$filename" "$verbose" _find_and_clean "*$filename" "$verbose"
done < "$path_mappings" done < "$path_mappings"
if [[ ! -z "$verbose" ]]; then if [[ -n "$verbose" ]]; then
echo echo
fi fi
fi fi