t script safety

This commit is contained in:
thek4n 2024-11-05 15:52:32 +03:00
parent 59f8ab46ea
commit bf79895ea8

View File

@ -10,7 +10,7 @@ readonly EXIT_SUCCESS=0
readonly NOTES_DIR_BASE="${HOME}/.t"
readonly NOTES_DIR="${NOTES_DIR_BASE}/${NS:-default}"
TAB="$(printf '\t')"
TAB="$(printf -- '\t')"
readonly TAB
@ -56,7 +56,7 @@ show_notes_with_indexes() {
note_lines="..."
fi
printf "[%d]\t%s\t(%s)\n" "${index}" "$(basename "${note}")" "${note_lines}"
printf -- '[%d]\t%s\t(%s)\n' "${index}" "$(basename -- "${note}")" "${note_lines}"
index="$((index+1))"
done
@ -132,7 +132,7 @@ cmd_show_namespaces() {
for ns in $(find "${NOTES_DIR_BASE}/" -mindepth 1 -maxdepth 1 -type d | sort -n)
do
namespace_notes_count="$(find "${ns}" -type f | wc -l)"
printf "%s\t(%s)\n" "$(basename "${ns}")" "${namespace_notes_count}"
printf -- '%s\t(%s)\n' "$(basename "${ns}")" "${namespace_notes_count}"
done
) | prettify
}