aboutsummaryrefslogtreecommitdiff
path: root/tasker.fish
blob: 43b6d2478c7063d6cb7af74a32eacda01b18853c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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'