t script feature sort by access time

This commit is contained in:
thek4n 2024-11-05 16:57:54 +03:00
parent bf79895ea8
commit f657e8be74

View File

@ -44,12 +44,19 @@ die() {
exit "${2:-$EXIT_SUCCESS}" exit "${2:-$EXIT_SUCCESS}"
} }
get_notes_sorted_by_access_time() {
find "${NOTES_DIR}" -maxdepth 1 -type f -printf '%C@ %p\n' \
| sort -k1 -r \
| cut -d" " -f2- \
| tr '\n' "${IFS}"
}
show_notes_with_indexes() { show_notes_with_indexes() {
SAVEIFS="${IFS}" SAVEIFS="${IFS}"
IFS=' IFS=';'
'
index=1 index=1
for note in $(find "${NOTES_DIR}" -maxdepth 1 -type f | sort -n) for note in $(IFS="${IFS}" get_notes_sorted_by_access_time)
do do
note_lines="$(wc -l < "${note}")" note_lines="$(wc -l < "${note}")"
if [ "${note_lines}" -gt 70 ]; then if [ "${note_lines}" -gt 70 ]; then