fixes for filenames with spaces

_list_all_added_files() now sets 'filenames' var, and
fixed quoting when updating hashes.
pull/239/head
joshr 6 years ago
parent bb2253af8a
commit 5c639cf8e7

@ -22,16 +22,16 @@ function changes {
_user_required
local filenames="$*"
if [[ -z "$filenames" ]]; then
filenames=("$@") # list of positional params. global.
if [[ ${#filenames[@]} -eq 0 ]]; then
# Checking if no filenames are passed, show diff for all files.
filenames=$(_list_all_added_files)
_list_all_added_files # this sets the array variable 'filenames'
fi
IFS='
'
for filename in $filenames; do
for filename in "${filenames[@]}"; do
local decrypted
local diff_result

@ -74,7 +74,7 @@ function _optional_fsdb_update_hash {
fsdb=$(_get_secrets_dir_paths_mapping)
_gawk_inplace -v key="$key" -v hash="$hash" "'$AWK_FSDB_UPDATE_HASH'" "$fsdb"
_gawk_inplace -v key="'$key'" -v hash="$hash" "'$AWK_FSDB_UPDATE_HASH'" "$fsdb"
}

@ -18,5 +18,10 @@ function list {
_user_required
# Command logic:
_list_all_added_files
filenames=()
_list_all_added_files # exports 'filenames' array
local filename
for filename in "${filenames[@]}"; do
echo "$filename"
done
}

Loading…
Cancel
Save