From 2dadf7ce1fd2d2d02432f701abb0c1188644d222 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 8 Sep 2025 23:00:25 +0100 Subject: [PATCH] Allow for easily editing or deleting the last zet --- zet | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/zet b/zet index f71d466..86c1c26 100755 --- a/zet +++ b/zet @@ -40,7 +40,11 @@ commit_changes() { delete_zet() { query="$1" - file="${ZET_DIR}/${query}/index.adoc" + if [[ "$1" == "last" ]]; then + file="$(find "$ZET_DIR" -type f -name "index.adoc" | sort | tail -1)" + else + file="${ZET_DIR}/${query}/index.adoc" + fi if [[ -f "$file" ]]; then run_git_command rm -rf "$file" @@ -75,7 +79,11 @@ delete_zet() { edit_zet() { query="$1" - file="${ZET_DIR}/${query}/index.adoc" + if [[ "$1" == "last" ]]; then + file="$(find "$ZET_DIR" -type f -name "index.adoc" | sort | tail -1)" + else + file="${ZET_DIR}/${query}/index.adoc" + fi if [[ -f "$file" ]]; then "$EDITOR" "$file"