commit 35c5863319aef1bb74ea224bbfd301ace7bde5c2
parent e3ce13608ef3e5c61405dd3d429a1fec57fc82d9
Author: regexghost <dev@regexghost.com>
Date: Mon, 1 Jun 2026 16:30:01 +0100
show full entry and confirm before deleting
Diffstat:
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/bug.sh b/bug.sh
@@ -98,7 +98,7 @@ lineToFile () {
selectEntry () {
file="${1:-${BUG_PROJECT}}"
result="$(tail -n +2 "$file" | cut -f 1,4 | fzf -i | cut -f 1)"
- [ "$result" = "" ] && exit
+ [ "$result" = "" ] && return 1
echo "$result"
}
@@ -111,6 +111,7 @@ delLine () {
edit () {
id=$(selectEntry)
+ [ "$?" = "0" ] || exit
lineToFile $id
echo A:$id:B
"${VISUAL:-${EDITOR:-vi}}" /tmp/bug_todo_temp
@@ -120,7 +121,8 @@ edit () {
}
view () {
- id=$(selectEntry)
+ id="$1"
+ [ "$id" = "" ] && id=$(selectEntry) && { [ "$?" = "0" ] || exit; }
lineToFile $id
output="$(cat /tmp/bug_todo_temp | sed "\
s/^ID:/\\${MAGENTA}\\${BOLD}ID:\\${RESET_COLOUR}/g; \
@@ -145,12 +147,19 @@ list () {
delete () {
id=$(selectEntry)
- awk "/^${id}\t/" "$BUG_PROJECT" >> "$BUG_PROJECT_DEL"
- delLine "$id" "$BUG_PROJECT"
+ [ "$?" = "0" ] || exit
+ view "$id"
+ echo ""
+ read -p "Delete? (y/N) " yesOrNo
+ if [ "$yesOrNo" = "y" ] || [ "$yesOrNo" = "Y" ]; then
+ awk "/^${id}\t/" "$BUG_PROJECT" >> "$BUG_PROJECT_DEL"
+ delLine "$id" "$BUG_PROJECT"
+ fi
}
restore () {
id=$(selectEntry "$BUG_PROJECT_DEL")
+ [ "$?" = "0" ] || exit
awk "/^${id}\t/" "$BUG_PROJECT_DEL" >> "$BUG_PROJECT"
delLine "$id" "$BUG_PROJECT_DEL"
}