Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
Oliver Davies 2025-09-09 00:58:41 +01:00
parent e1653bc7e0
commit 859762379f

6
zet
View file

@ -128,7 +128,7 @@ get_last_zet() {
find "$ZET_DIR" -type f -name "index.adoc" | sort | tail -1 find "$ZET_DIR" -type f -name "index.adoc" | sort | tail -1
} }
get_zet_id_from_filename() { get_zet_id_from_filepath() {
basename "$(dirname "$file")" basename "$(dirname "$file")"
} }
@ -169,7 +169,7 @@ run_git_command() {
search_zets() { search_zets() {
grep --recursive --ignore-case --files-with-matches "$*" "$ZET_DIR" | while read -r file; do grep --recursive --ignore-case --files-with-matches "$*" "$ZET_DIR" | while read -r file; do
id="$(get_zet_id_from_filename "$file")" id="$(get_zet_id_from_filepath "$file")"
title=$(head -1 "$file" | sed 's/^= //' | sed 's/# //') title=$(head -1 "$file" | sed 's/^= //' | sed 's/# //')
echo "$id $title" echo "$id $title"
@ -194,7 +194,7 @@ show_zet() {
update_zet_list() { update_zet_list() {
find "$ZET_DIR" -type f -name 'index.adoc' | while read -r file; do find "$ZET_DIR" -type f -name 'index.adoc' | while read -r file; do
id="$(get_zet_id_from_filename "$file")" id="$(get_zet_id_from_filepath "$file")"
title=$(head -n 1 "$file" | sed 's/^= //' | sed 's/^# //') title=$(head -n 1 "$file" | sed 's/^= //' | sed 's/^# //')
echo "$id $title" echo "$id $title"