function __tasker_no_subcommand not __fish_seen_subcommand_from new list set delete end function __tasker_task_dirs if test -d $PWD/tasks set root $PWD/tasks else set root $PWD end for d in $root/*/ set trimmed (string trim -r -c '/' $d) set parts (string split '/' $trimmed) set name $parts[-1] if string match -qr '^\d{2}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(\.\d+)?$' $name echo $name end end end complete -c tasker -n __tasker_no_subcommand -f -a new -d 'Create a new task' complete -c tasker -n __tasker_no_subcommand -f -a list -d 'List tasks' complete -c tasker -n __tasker_no_subcommand -f -a set -d 'Update a task' complete -c tasker -n __tasker_no_subcommand -f -a delete -d 'Delete a task' complete -c tasker -n '__fish_seen_subcommand_from new' \ -s p -d 'Priority (integer)' -r complete -c tasker -n '__fish_seen_subcommand_from new' \ -s d -d 'Description' -r complete -c tasker -n '__fish_seen_subcommand_from list' \ -s s -l status -d 'Filter by status' -r \ -a 'OPEN\tOpen IN_PROGRESS\tIn-progress CLOSED\tClosed' complete -c tasker -n '__fish_seen_subcommand_from list' \ -s p -l priority -d 'Filter by exact priority' -r complete -c tasker -n '__fish_seen_subcommand_from list' \ -l min-priority -d 'Filter by minimum priority' -r complete -c tasker -n '__fish_seen_subcommand_from list' \ -s c -l contains -d 'Filter by text' -r complete -c tasker -n '__fish_seen_subcommand_from set' \ -f -a '(__tasker_task_dirs)' -d 'Task directory' complete -c tasker -n '__fish_seen_subcommand_from set' \ -s n -l name -d 'Rename the task' -r complete -c tasker -n '__fish_seen_subcommand_from set' \ -s s -l status -d 'Set status' -r \ -a 'OPEN\tOpen IN_PROGRESS\tIn\ progress CLOSED\tClosed' complete -c tasker -n '__fish_seen_subcommand_from set' \ -s p -l priority -d 'Set priority (integer)' -r complete -c tasker -n '__fish_seen_subcommand_from set' \ -s d -l desc -d 'Set description' -r complete -c tasker -n '__fish_seen_subcommand_from delete' \ -f -a '(__tasker_task_dirs)' -d 'Task directory'