diff --git a/zet b/zet index 4550d13..5098cd6 100755 --- a/zet +++ b/zet @@ -128,7 +128,7 @@ get_last_zet() { find "$ZET_DIR" -type f -name "index.adoc" | sort | tail -1 } -get_zet_id_from_filename() { +get_zet_id_from_filepath() { basename "$(dirname "$file")" } @@ -169,7 +169,7 @@ run_git_command() { search_zets() { 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/# //') echo "$id $title" @@ -194,7 +194,7 @@ show_zet() { update_zet_list() { 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/^# //') echo "$id $title"