diff options
author | filip <“filip.rabiega@gmail.com”> | 2025-10-14 21:57:25 +0200 |
---|---|---|
committer | filip <“filip.rabiega@gmail.com”> | 2025-10-14 21:57:25 +0200 |
commit | 91a4eacb0419bd0f67774f6124b6f0b1525eb988 (patch) | |
tree | de8189790a11437e540f7792fd7559f88212bae7 /todo | |
parent | 7f6189dcbed755af34e222237b8cfa8b1f903696 (diff) | |
download | chadscripts-91a4eacb0419bd0f67774f6124b6f0b1525eb988.tar.gz chadscripts-91a4eacb0419bd0f67774f6124b6f0b1525eb988.tar.bz2 chadscripts-91a4eacb0419bd0f67774f6124b6f0b1525eb988.zip |
new stuff
Diffstat (limited to 'todo')
-rwxr-xr-x | todo | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -0,0 +1,28 @@ +#!/bin/sh +# +# Write/remove a task to do later. +# +# Select an existing entry to remove it from the file, or type a new entry to +# add it. +# + +file="$HOME/.local/opt/todo" +touch "$file" +height="$(wc -l "$file" | awk '{print $1}')" +prompt="Add/delete a task: " + +cmd=$(dmenu -l "$height" -p "$prompt" "$@" < "$file") +while [ -n "$cmd" ]; do + if grep -q "^$cmd\$" "$file"; then + grep -v "^$cmd\$" "$file" > "$file.$$" + mv "$file.$$" "$file" + height=$(( height - 1 )) + else + echo "$cmd" >> "$file" + height=$(( height + 1 )) + fi + + cmd=$(dmenu -l "$height" -p "$prompt" "$@" < "$file") +done + +exit 0 |