diff --git a/src/commands/git_secret_changes.sh b/src/commands/git_secret_changes.sh index 61af7aeb..371a3785 100644 --- a/src/commands/git_secret_changes.sh +++ b/src/commands/git_secret_changes.sh @@ -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 diff --git a/src/commands/git_secret_hide.sh b/src/commands/git_secret_hide.sh index 8f227e87..1490bcd7 100644 --- a/src/commands/git_secret_hide.sh +++ b/src/commands/git_secret_hide.sh @@ -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" } diff --git a/src/commands/git_secret_list.sh b/src/commands/git_secret_list.sh index dccba3a5..fe757867 100644 --- a/src/commands/git_secret_list.sh +++ b/src/commands/git_secret_list.sh @@ -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 }