-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproctrack
executable file
·55 lines (51 loc) · 1.15 KB
/
proctrack
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
53
54
55
#!/bin/bash
# this is where the times are stored
touch ~/.proctimes
function focus-task {
while true; do
pass;
done
}
function enter-time {
# gets the new run time from proctime
newtime=$(proctime "$1")
# adds appropriate number of zeros (maybe not necessary?)
# numunits=$(echo "$newtime" | sed -e 's/\(.\)/\1\n/g' | grep -c ":")
# numunits=$numunits+1
# case $numunits in
# 2 )
# newtime="00:00:${newtime}"
# ;;
# 3 )
# newtime="00:${newtime}"
# ;;
# esac
prpnd "$(date +%d%m%y) ${1} ${newtime}" ~/.proctimes
formated=$(column -t ~/.proctimes)
echo "$formated" > ~/.proctimes
}
case $1 in
-h | --help )
printf "small utility for tracking time!
usage: proctrack [options] [program]
options:
'focus [name]' for arbitrary activities which may not be programs. will add an entry for [name] in .proctimes
'focus end' ends timer started by 'focus [name]'"
;;
focus )
if [[ $# -gt 1 ]]; then case $2 in
end )
printf "ending timer"
;;
* )
printf "sorry, not sure what you want me to do :)"
;;
esac else
printf "starting timer for %s" "$1"
enter-time focus-task "$1"
fi
;;
* )
enter-time "$1"
;;
esac