diff options
-rwxr-xr-x | bin/task/context | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/bin/task/context b/bin/task/context index d0bb6c4..431b6ad 100755 --- a/bin/task/context +++ b/bin/task/context | |||
@@ -36,8 +36,8 @@ _set_context_plan() { | |||
36 | done <~/log/plan.context.md | 36 | done <~/log/plan.context.md |
37 | } | 37 | } |
38 | 38 | ||
39 | # Update time of current context | 39 | # Update spend time on current context |
40 | if [ -n "$1" ]; then | 40 | _update_spend_time() { |
41 | # If current conetxt is not given, exit with 1 | 41 | # If current conetxt is not given, exit with 1 |
42 | if [ -z "$context" ] || [ "$context" = none ]; then | 42 | if [ -z "$context" ] || [ "$context" = none ]; then |
43 | exit 1 | 43 | exit 1 |
@@ -56,8 +56,10 @@ if [ -n "$1" ]; then | |||
56 | 56 | ||
57 | # Update Log file | 57 | # Update Log file |
58 | echo -e "$context\t${given_seconds}" >>$LOG_FILE | 58 | echo -e "$context\t${given_seconds}" >>$LOG_FILE |
59 | # Print times for each context | 59 | } |
60 | else | 60 | |
61 | # Print spend for each context | ||
62 | _print_spend_time() { | ||
61 | _set_context_plan | 63 | _set_context_plan |
62 | while read -r ctx sec; do | 64 | while read -r ctx sec; do |
63 | # Print context and time I spend | 65 | # Print context and time I spend |
@@ -90,4 +92,10 @@ else | |||
90 | fi | 92 | fi |
91 | echo | 93 | echo |
92 | done <$LOG_FILE | 94 | done <$LOG_FILE |
95 | } | ||
96 | |||
97 | if [ -n "$1" ]; then | ||
98 | _update_spend_time | ||
99 | else | ||
100 | _print_spend_time | ||
93 | fi | 101 | fi |