t script style

This commit is contained in:
thek4n 2024-11-27 15:58:29 +03:00
parent 9e81d06b2e
commit 0cecbd4e43

View File

@ -91,6 +91,10 @@ get_notes_with_indexes() {
index=1 index=1
for note in $(IFS="${IFS}" get_notes_sorted_by_access_time) for note in $(IFS="${IFS}" get_notes_sorted_by_access_time)
do do
if [ -z "${note}" ]; then
continue
fi
if ${_TO_SHOW:-false}; then if ${_TO_SHOW:-false}; then
note_lines="$(wc -l < "${note}")" note_lines="$(wc -l < "${note}")"
@ -179,7 +183,7 @@ cmd_cat_note() {
die "Note with index ${note_index} not found" 1 die "Note with index ${note_index} not found" 1
fi fi
printf '\033[1m# %s\033[0m\n\n' "$(basename "${note_to_cat}")" printf '\033[1;34m# %s\033[0m\n\n' "$(basename "${note_to_cat}")"
cat "${note_to_cat}" cat "${note_to_cat}"
exit "${EXIT_SUCCESS}" exit "${EXIT_SUCCESS}"
} }
@ -195,7 +199,7 @@ cmd_show_namespaces() {
} }
cmd_show_notes() { cmd_show_notes() {
printf -- '\033[1m# %s\033[0m\n' "${t}" printf -- '\033[1;34m# %s\033[0m\n' "${t}"
_TO_SHOW=true get_notes_with_indexes | column -t -R 1,-1 -s "${TAB}" _TO_SHOW=true get_notes_with_indexes | column -t -R 1,-1 -s "${TAB}"
} }