dotfiles/.todo.actions.d/edit
2025-04-29 17:53:01 +01:00

20 lines
397 B
Bash
Executable file

#!/bin/bash
case $1 in
"usage")
echo "$(basename $0) [BASENAME]"
echo " Open \$TODO_DIR/BASENAME.txt in \$EDITOR."
echo " If BASENAME is not given, defaults to 'todo'."
;;
*)
if [[ -z $2 ]]; then
FILE=$TODO_FILE
else
FILE=$TODO_DIR/$2.txt
fi
if [ -n "$EDITOR" ]; then
$EDITOR "$FILE"
else
echo "Error: The EDITOR environment variable is not set"
fi
;;
esac