File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ Type `tusker help` to get started.
12
12
```
13
13
tusker add "The task that I would've forgotten"
14
14
```
15
- - Show current tasks * [ ID, Status, Description, CreatedAt ] *
15
+ - Show current tasks * [ ID, Status, Description, UpdatedAt ] *
16
16
```
17
17
tusker show
18
18
1 ❌ Collect laundry 25 April 2018 11:53:21
@@ -35,6 +35,14 @@ tusker show
35
35
2 ❌ Collect NOC certificate 25 April 2018 11:53:23
36
36
3 ❌ Fill rems 25 April 2018 11:53:25
37
37
```
38
+ - Edit the description for an existing task
39
+ ```
40
+ tusker edit 3 Fill rems and forms
41
+ tusker show
42
+ 1 ❌ Collect laundry 25 April 2018 11:53:21
43
+ 2 ❌ Collect NOC certificate 25 April 2018 11:53:23
44
+ 3 ❌ Fill rems and forms 25 April 2018 11:53:25
45
+ ```
38
46
- Delete one or more tasks from the list
39
47
```
40
48
tusker del 1 3
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ HELP_MSG="
15
15
Mark a task as done : tusker check TASK_ID
16
16
Mark a task as undone : tusker uncheck TASK_ID
17
17
Delete a task : tusker del TASK_ID
18
+ Edit task description : tusker edit TASK_ID NEW_TASK_DESCRIPTION
18
19
Show existing tasks : tusker show
19
20
"
20
21
@@ -75,6 +76,15 @@ uncheck_task() {
75
76
done
76
77
}
77
78
79
+ edit_task () {
80
+ task_id=" $1 "
81
+ shift
82
+ task_desc=" $* "
83
+ current_timestamp=$( date +" %d %B %Y %H:%M:%S" )
84
+ task_string=" $CROSS $DELIM $task_desc $DELIM $current_timestamp "
85
+ sed -i " $task_id s/.*/$task_string /" " $FILE_NAME "
86
+ }
87
+
78
88
show_tasks () {
79
89
line_count=$( wc -l $FILE_NAME | awk ' {print $1}' )
80
90
@@ -98,8 +108,8 @@ main() {
98
108
shift
99
109
add_task " $* "
100
110
printf " Task added\n"
101
- ;;
102
111
112
+ ;;
103
113
del)
104
114
shift
105
115
delete_task " $@ "
@@ -118,6 +128,12 @@ main() {
118
128
printf " Task(s) marked as undone\n"
119
129
;;
120
130
131
+ edit)
132
+ shift
133
+ edit_task " $@ "
134
+ printf " Task edited\n"
135
+ ;;
136
+
121
137
show)
122
138
show_tasks
123
139
;;
You can’t perform that action at this time.
0 commit comments