forked from tgdnt/remind
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremind
executable file
·52 lines (43 loc) · 1.25 KB
/
remind
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
51
52
#!/usr/bin/env bash
action=$1
shift
[ "$1" = "usage" ] && {
echo " Remind:"
echo " $TODO_SH remind ITEM# DATE TIME"
echo " create a reminder out of the todo item with an alert time"
echo ""
exit
}
case "$1" in
[0-9]*)
getTodo "$1"
$TODO_SH append "$1" "#reminded"
osascript - "$todo" "$2" "$3" <<END
to convertDate(textDate)
set resultDate to the current date
set the year of resultDate to (text 1 thru 4 of textDate)
set the month of resultDate to (text 6 thru 7 of textDate)
set the day of resultDate to (text 9 thru 10 of textDate)
set the time of resultDate to 0
if (length of textDate) > 10 then
set the hours of resultDate to (text 12 thru 13 of textDate)
set the minutes of resultDate to (text 15 thru 16 of textDate)
if (length of textDate) > 16 then
set the seconds of resultDate to (text 18 thru 19 of textDate)
end if
end if
return resultDate
end convertDate
on run argv
set myDate to convertDate(item 2 of argv & " " & item 3 of argv)
tell application "Reminders"
tell list "Reminders" of default account
make new reminder with properties {name:item 1 of argv, remind me date:myDate}
end tell
end tell
end run
END
;;
*)
echo "Usage: $TODO_SH remind ITEM# DATE TIME"
esac