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.
1212```
1313tusker add "The task that I would've forgotten"
1414```
15- - Show current tasks * [ ID, Status, Description, CreatedAt ] *
15+ - Show current tasks * [ ID, Status, Description, UpdatedAt ] *
1616```
1717tusker show
1818 1 ❌ Collect laundry 25 April 2018 11:53:21
@@ -35,6 +35,14 @@ tusker show
3535 2 ❌ Collect NOC certificate 25 April 2018 11:53:23
3636 3 ❌ Fill rems 25 April 2018 11:53:25
3737```
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+ ```
3846- Delete one or more tasks from the list
3947```
4048tusker del 1 3
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ HELP_MSG="
1515 Mark a task as done : tusker check TASK_ID
1616 Mark a task as undone : tusker uncheck TASK_ID
1717 Delete a task : tusker del TASK_ID
18+ Edit task description : tusker edit TASK_ID NEW_TASK_DESCRIPTION
1819 Show existing tasks : tusker show
1920"
2021
@@ -75,6 +76,15 @@ uncheck_task() {
7576 done
7677}
7778
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+
7888show_tasks () {
7989 line_count=$( wc -l $FILE_NAME | awk ' {print $1}' )
8090
@@ -98,8 +108,8 @@ main() {
98108 shift
99109 add_task " $* "
100110 printf " Task added\n"
101- ;;
102111
112+ ;;
103113 del)
104114 shift
105115 delete_task " $@ "
@@ -118,6 +128,12 @@ main() {
118128 printf " Task(s) marked as undone\n"
119129 ;;
120130
131+ edit)
132+ shift
133+ edit_task " $@ "
134+ printf " Task edited\n"
135+ ;;
136+
121137 show)
122138 show_tasks
123139 ;;
You can’t perform that action at this time.
0 commit comments