Skip to content

Commit

Permalink
command changes to print when list is specified with list flag
Browse files Browse the repository at this point in the history
  • Loading branch information
SkwalExe committed Mar 24, 2022
1 parent f0b87ae commit c2a781a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dtodo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function printTodoList() { # Prints the specified (first argument passed to the
content=$(cat -b $1) # -b to add lien number

if [[ -z ${content// } ]]; then # the // is to remove trailing spaces
printf "${blue}[ i ] : The daily todo list is empty \n"
printf "\n${blue}[ i ] : The daily todo list is empty \n"
else
printf "\n${blue}$content\n"
fi
Expand All @@ -56,7 +56,7 @@ checkExist
function parseArgs() { # parse command line arguments


command=${1:-default} # the command to execute on the todo list # if not argument is specified, default command (printall) is used
command=${1:-${command:-default}} # the command to execute on the todo list # if not argument is specified, default command (printall) is used

case "$command" in

Expand All @@ -71,6 +71,7 @@ function parseArgs() { # parse command line arguments
else
tdfile="dtodo-$_tdfile"
shift
command="print"
parseArgs $@ # parse args again to execute the specified command on the just specified todo list
fi

Expand Down Expand Up @@ -306,6 +307,8 @@ function parseArgs() { # parse command line arguments
printf "${blue}━━━━━━━━━━━━━━━━━${reset}\n"
;;



*)
printf "${red}[ x ] : Invalid argument : $1\n"
exit 1;
Expand Down

0 comments on commit c2a781a

Please sign in to comment.