Allow for easily editing or deleting the last zet

This commit is contained in:
Oliver Davies 2025-09-08 23:00:25 +01:00
parent f46f956d58
commit 2dadf7ce1f

12
zet
View file

@ -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"