change script t

This commit is contained in:
thek4n 2024-11-06 00:49:43 +03:00
parent 79ccb183ef
commit 4beb245aa4

View File

@ -8,7 +8,7 @@ set -o nounset
readonly EXIT_SUCCESS=0 readonly EXIT_SUCCESS=0
readonly NOTES_DIR_BASE="${HOME}/.t" readonly NOTES_DIR_BASE="${HOME}/.t"
readonly NOTES_DIR="${NOTES_DIR_BASE}/${ns:-default}" readonly NOTES_DIR="${NOTES_DIR_BASE}/${t:-default}"
TAB="$(printf -- '\t')" TAB="$(printf -- '\t')"
readonly TAB readonly TAB
@ -34,8 +34,8 @@ cmd_help() {
NAMESPACES NAMESPACES
t namespaces # show namespaces t namespaces # show namespaces
ns=work t a fix bug 211 # add note in workspace 'work' t=work t a fix bug 211 # add note in workspace 'work'
ns=work t # show notes in workspace 'work'" t=work t # show notes in workspace 'work'"
} }
@ -138,10 +138,10 @@ prettify() {
cmd_show_namespaces() { cmd_show_namespaces() {
( (
for ns in $(find "${NOTES_DIR_BASE}/" -mindepth 1 -maxdepth 1 -type d | sort -n) for namespace in $(find "${NOTES_DIR_BASE}/" -mindepth 1 -maxdepth 1 -type d | sort -n)
do do
namespace_notes_count="$(find "${ns}" -type f | wc -l)" namespace_notes_count="$(find "${namespace}" -type f | wc -l)"
printf -- '%s\t(%s)\n' "$(basename "${ns}")" "${namespace_notes_count}" printf -- '%s\t(%s)\n' "$(basename "${namespace}")" "${namespace_notes_count}"
done done
) | prettify ) | prettify
} }