Skip to content

Commit

Permalink
fixed bug - r option - tasks not correctly removed
Browse files Browse the repository at this point in the history
  • Loading branch information
SkwalExe committed Mar 19, 2022
1 parent b869f35 commit 5ef5052
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions dtodo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,13 @@ function parseArgs() {
else
re='^[0-9]+$'

while [ $# -gt 0 ]; do
taskId="$1"
taskId="$@"

[[ ! $taskId =~ $re ]] && printf "${red}[ x ] : Invalid task id\n" && exit 1;

printf "${blue}[ i ] : Removing task $taskId\n"
sed -i "${taskId}d" ~/.$tdfile
shift
done
[[ ! $taskId =~ $re ]] && printf "${red}[ x ] : Invalid task id, note that you can only specify one task : ${red}$taskId\n" && exit 1;

printf "${blue}[ i ] : Removing task $taskId\n"
sed -i "${taskId}d" ~/.$tdfile
shift
fi
printTodo ~/.$tdfile

Expand Down

0 comments on commit 5ef5052

Please sign in to comment.