# Defined in /tmp/fish.iOyNXX/todo.fish @ line 2 function todo argparse --name=todo 'n/next' 't/today' 's/show' 'r/rotate' 'd/done=' -- $argv or return 1 test -n "$_flag_n"; and set -l day 'next' test -n "$_flag_t"; and set -l day 'today' test -z "$day" -a -n "$_flag_s"; and set -l day 'today' test -z "$day" -a -n "$_flag_d"; and set -l day 'today' test -z "$day"; and set -l day 'next' set day_print "$day" test "$day" = "next"; and set day_print "tomorrow" # rename next to tomorrow when printing set file ~/todo/"$day".md if test -n "$_flag_s" test ! -e "$file"; and echo "Nothing todo $day_print"; and return 0 echo -e "# TODO $day_print\n" | bat --color always -l markdown -p - "$file" else if test -n "$_flag_r" # if no todos are due for tomorrow, return test ! -e ~/todo/next.md;and echo "Nothing todo tomorrow"; and return 0 cat ~/todo/next.md >> ~/todo/today.md rm ~/todo/next.md else if test -n "$_flag_d" # the number to remove is first arg set num "$_flag_d" set num (math "1 + ($num - 1) * 2") set todos (cat "$file") set elem $todos[$num] # remove fields in array set -e todos[$num] set -e todos[$num] # join elements by newlines. This creates a leading newline # which is then ignored by using tail with the count of elements # in the todos array echo -e \n$todos | tail -(count $todos) > "$file" echo "\"$elem\" is no longer on the list for $day_print" else echo -e "* $argv\n" >> $file echo "Added todo for $day_print: \"$argv\"" end end