mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-24 14:36:42 +02:00
Add completion
This commit is contained in:
parent
5cf41c19e3
commit
54e4cce084
7 changed files with 279 additions and 2 deletions
0
completions/.gitkeep
Normal file
0
completions/.gitkeep
Normal file
38
completions/_taskwarrior-tui
Normal file
38
completions/_taskwarrior-tui
Normal file
|
@ -0,0 +1,38 @@
|
|||
#compdef taskwarrior-tui
|
||||
|
||||
autoload -U is-at-least
|
||||
|
||||
_taskwarrior-tui() {
|
||||
typeset -A opt_args
|
||||
typeset -a _arguments_options
|
||||
local ret=1
|
||||
|
||||
if is-at-least 5.2; then
|
||||
_arguments_options=(-s -S -C)
|
||||
else
|
||||
_arguments_options=(-s -C)
|
||||
fi
|
||||
|
||||
local context curcontext="$curcontext" state line
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-c+[Sets a custom config file]' \
|
||||
'--config=[Sets a custom config file]' \
|
||||
'-r+[Sets default report]' \
|
||||
'--report=[Sets default report]' \
|
||||
'-h[Prints help information]' \
|
||||
'--help[Prints help information]' \
|
||||
'-V[Prints version information]' \
|
||||
'--version[Prints version information]' \
|
||||
&& ret=0
|
||||
|
||||
}
|
||||
|
||||
(( $+functions[_taskwarrior-tui_commands] )) ||
|
||||
_taskwarrior-tui_commands() {
|
||||
local commands; commands=(
|
||||
|
||||
)
|
||||
_describe -t commands 'taskwarrior-tui commands' commands "$@"
|
||||
}
|
||||
|
||||
_taskwarrior-tui "$@"
|
57
completions/taskwarrior-tui.bash
Normal file
57
completions/taskwarrior-tui.bash
Normal file
|
@ -0,0 +1,57 @@
|
|||
_taskwarrior-tui() {
|
||||
local i cur prev opts cmds
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
cmd=""
|
||||
opts=""
|
||||
|
||||
for i in ${COMP_WORDS[@]}
|
||||
do
|
||||
case "${i}" in
|
||||
taskwarrior-tui)
|
||||
cmd="taskwarrior__tui"
|
||||
;;
|
||||
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "${cmd}" in
|
||||
taskwarrior__tui)
|
||||
opts=" -c -r -h -V --config --report --help --version "
|
||||
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
fi
|
||||
case "${prev}" in
|
||||
|
||||
--config)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-c)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
--report)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-r)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=()
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
||||
complete -F _taskwarrior-tui -o bashdefault -o default taskwarrior-tui
|
4
completions/taskwarrior-tui.fish
Normal file
4
completions/taskwarrior-tui.fish
Normal file
|
@ -0,0 +1,4 @@
|
|||
complete -c taskwarrior-tui -n "__fish_use_subcommand" -s c -l config -d 'Sets a custom config file' -r
|
||||
complete -c taskwarrior-tui -n "__fish_use_subcommand" -s r -l report -d 'Sets default report' -r
|
||||
complete -c taskwarrior-tui -n "__fish_use_subcommand" -s h -l help -d 'Prints help information'
|
||||
complete -c taskwarrior-tui -n "__fish_use_subcommand" -s V -l version -d 'Prints version information'
|
Loading…
Add table
Add a link
Reference in a new issue