-
Notifications
You must be signed in to change notification settings - Fork 3
/
15-events.rc
executable file
·50 lines (44 loc) · 1.46 KB
/
15-events.rc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# shellcheck disable=SC2148 disable=SC1090 shell=bash
# Events - things that are triggered by other things
# ### remindme ###
# REMINDME_PATH="${HOME}/git/scripts/remindme.sh"
# COMMAND_NAME="remind"
# #
# # Configure directories to check for reminders
# # shellcheck disable=SC2088
# CHECK_REMINDER_DIRECTORIES=("${HOME}/git" "~/git" "${HOME}/Documents" "~/Downloads" "~/Documents")
# #
# # Function to check if the current directory is in the list of directories to check
# should_check_reminders() {
# local dir
# for dir in "${CHECK_REMINDER_DIRECTORIES[@]}"; do
# if [[ "${PWD/#$HOME/~}" == "$dir" ]]; then
# return 0
# fi
# done
# return 1
# }
# # Function to check for reminders related to the current directory
# check_reminders_on_chdir() {
# if should_check_reminders; then
# local reminders
# reminders=$(source "$REMINDME_PATH" -l | while IFS= read -r line; do
# if [[ "$line" == *"$PWD"* ]]; then
# echo "${line#*= }"
# fi
# done)
# if [ -n "$reminders" ]; then
# echo "Reminders for this directory:"
# echo "$reminders"
# echo "Use \"${COMMAND_NAME} -d <reminder_id>\" to mark a reminder as completed."
# fi
# fi
# }
# # Call the check_reminders_on_chdir function whenever you change directories
# autoload -U add-zsh-hook
# add-zsh-hook chpwd check_reminders_on_chdir
# # Define the reminder_me function for convenience
# remind() {
# source "$REMINDME_PATH" "$@"
# }
### END remindme ###