Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit be790e5

Browse files
Add feature to delete multiple tasks
1 parent 8665973 commit be790e5

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

‎README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff 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`?
4753
Use `del` if you'd *never* like to look back at a completed task.
4854
Use `check` if you want the satisfaction of seeing the ✓ beside your completed task for a while.

‎tusker

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff 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

4848
delete_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

5357
check_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)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /