File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,12 @@ tusker show
4343 2 ❌ Fill rems 25 April 2018 11:53:25
4444```
4545
46+ - Delete multiple tasks from the list
47+ ```
48+ tusker del 1 3
49+ tusker show
50+ 1 ❌ Collect NOC certificate 25 April 2018 11:53:23
51+ ```
4652### What's the difference between ` check ` and ` del ` ?
4753Use ` del ` if you'd * never* like to look back at a completed task.
4854Use ` check ` if you want the satisfaction of seeing the ✓ beside your completed task for a while.
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ check_args() {
2020 return
2121 fi
2222
23- if [ $# -gt 1 ] && [ " $1 " = " add" ]; then
23+ if [ $# -gt 1 ] && ( [ " $1 " = " add" ] || [ " $1 " = " del " ]) ; then
2424 return
2525 fi
2626
@@ -46,8 +46,12 @@ add_task() {
4646}
4747
4848delete_task () {
49- task_id=$1
50- sed -i -e " $task_id " " d" " $FILE_NAME "
49+ format_str=" "
50+ for task_id in " $@ "
51+ do
52+ format_str=" $task_id " " d;" " $format_str "
53+ done
54+ sed -i -e " $format_str " " $FILE_NAME "
5155}
5256
5357check_task () {
@@ -86,8 +90,9 @@ main() {
8690 ;;
8791
8892 del)
89- delete_task " $2 "
90- printf " Task deleted\n"
93+ shift
94+ delete_task " $@ "
95+ printf " Task(s) deleted\n"
9196 ;;
9297
9398 check)
You can’t perform that action at this time.
0 commit comments