mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 02:35:38 +01:00
feat(taskman): add terminal task manager plugin
This commit is contained in:
parent
042605ee6b
commit
9fc3f3dcd6
5 changed files with 1120 additions and 0 deletions
69
plugins/taskman/_taskman
Normal file
69
plugins/taskman/_taskman
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#compdef tasks tm task todo
|
||||
|
||||
# Terminal Task Manager completion for Oh-My-Zsh
|
||||
# Provides tab completion for all task management commands
|
||||
|
||||
_taskman() {
|
||||
local context state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
'1:command:->commands' \
|
||||
'*::arg:->args' && return 0
|
||||
|
||||
case $state in
|
||||
commands)
|
||||
local -a commands
|
||||
commands=(
|
||||
'ui:Launch interactive UI'
|
||||
'show:Launch interactive UI'
|
||||
'add:Add new task'
|
||||
'new:Add new task'
|
||||
'create:Add new task'
|
||||
'list:List tasks'
|
||||
'ls:List tasks'
|
||||
'done:Mark task as completed'
|
||||
'complete:Mark task as completed'
|
||||
'delete:Delete a task'
|
||||
'del:Delete a task'
|
||||
'rm:Delete a task'
|
||||
'help:Show help'
|
||||
)
|
||||
_describe 'taskman commands' commands
|
||||
;;
|
||||
args)
|
||||
case $line[1] in
|
||||
add|new|create)
|
||||
_arguments \
|
||||
'1:task description:' \
|
||||
'2:priority:(high normal low)'
|
||||
;;
|
||||
list|ls)
|
||||
_arguments \
|
||||
'1:filter:(all pending completed)'
|
||||
;;
|
||||
done|complete|delete|del|rm)
|
||||
# Complete with task IDs if possible
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
local plugin_dir="${0:h}"
|
||||
local -a task_ids
|
||||
|
||||
# Try to get task IDs from the CLI
|
||||
task_ids=($(python3 "$plugin_dir/bin/task_cli.py" list all 2>/dev/null | grep -o '(ID: [0-9]\+)' | grep -o '[0-9]\+' 2>/dev/null))
|
||||
|
||||
if [[ ${#task_ids[@]} -gt 0 ]]; then
|
||||
_describe 'task IDs' task_ids
|
||||
else
|
||||
_message 'task ID'
|
||||
fi
|
||||
else
|
||||
_message 'task ID'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_taskman
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue