-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtodone
More file actions
executable file
·31 lines (26 loc) · 1.04 KB
/
todone
File metadata and controls
executable file
·31 lines (26 loc) · 1.04 KB
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
#!/bin/bash
if [ "`uname -s`" == "Linux" ];then
SED=sed
else
SED=gsed
fi
if [ -z "$TODO_FILE" ]; then
echo "Environment variable TODO_FILE must be set"
exit 1
fi
_TODOS=`grep -i "$@" $TODO_FILE`
_NUM=`echo "$*" | grep '^[0-9]\+$'`
if [ -n "$_NUM" ];then
_SCRIPT="${_NUM}d"
else
_SCRIPT="/$*/Id"
fi
$SED -i -e "$_SCRIPT" $TODO_FILE
if [ -n "$TODO_REPO" ]; then
#GIT_DIR="$TODO_REPO/.git" GIT_WORK_TREE="$TODO_REPO" git pull -q
GIT_DIR="$TODO_REPO/.git" GIT_WORK_TREE="$TODO_REPO" git commit -q -am 'Removed todo'
GIT_DIR="$TODO_REPO/.git" GIT_WORK_TREE="$TODO_REPO" git push -q &
fi
if [ -n "`which notify-send`" ]; then
echo -e "$_TODOS" | notify-send "$_TODOS is DONE"
fi