feat: Update cli interface

This commit is contained in:
Dheepak Krishnamurthy 2021-12-31 23:58:09 -07:00
parent d8176e01df
commit 8342ce05af
8 changed files with 137 additions and 13 deletions

View file

@ -15,8 +15,12 @@ _taskwarrior-tui() {
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
'-c+[Sets a custom config file]:FILE: ' \
'--config=[Sets a custom config file]:FILE: ' \
'-d+[Sets the data folder for taskwarrior-tui]:FOLDER: ' \
'--data=[Sets the data folder for taskwarrior-tui]:FOLDER: ' \
'-c+[Sets the config folder for taskwarrior-tui]:FOLDER: ' \
'--config=[Sets the config folder for taskwarrior-tui]:FOLDER: ' \
'--taskdata=[Sets the .task folder using the TASKDATA environment variable for taskwarrior]:FOLDER: ' \
'--taskrc=[Sets the .taskrc file using the TASKRC environment variable for taskwarrior]:FILE: ' \
'-r+[Sets default report]:STRING: ' \
'--report=[Sets default report]:STRING: ' \
'-h[Print help information]' \

View file

@ -20,8 +20,12 @@ Register-ArgumentCompleter -Native -CommandName 'taskwarrior-tui' -ScriptBlock {
$completions = @(switch ($command) {
'taskwarrior-tui' {
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'Sets a custom config file')
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'Sets a custom config file')
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'Sets the data folder for taskwarrior-tui')
[CompletionResult]::new('--data', 'data', [CompletionResultType]::ParameterName, 'Sets the data folder for taskwarrior-tui')
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'Sets the config folder for taskwarrior-tui')
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'Sets the config folder for taskwarrior-tui')
[CompletionResult]::new('--taskdata', 'taskdata', [CompletionResultType]::ParameterName, 'Sets the .task folder using the TASKDATA environment variable for taskwarrior')
[CompletionResult]::new('--taskrc', 'taskrc', [CompletionResultType]::ParameterName, 'Sets the .taskrc file using the TASKRC environment variable for taskwarrior')
[CompletionResult]::new('-r', 'r', [CompletionResultType]::ParameterName, 'Sets default report')
[CompletionResult]::new('--report', 'report', [CompletionResultType]::ParameterName, 'Sets default report')
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information')

View file

@ -19,12 +19,20 @@ _taskwarrior-tui() {
case "${cmd}" in
taskwarrior__tui)
opts="-h -V -c -r --help --version --config --report"
opts="-h -V -d -c -r --help --version --data --config --taskdata --taskrc --report"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--data)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-d)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--config)
COMPREPLY=($(compgen -f "${cur}"))
return 0
@ -33,6 +41,14 @@ _taskwarrior-tui() {
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--taskdata)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--taskrc)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--report)
COMPREPLY=($(compgen -f "${cur}"))
return 0

View file

@ -1,4 +1,7 @@
complete -c taskwarrior-tui -s c -l config -d 'Sets a custom config file' -r
complete -c taskwarrior-tui -s d -l data -d 'Sets the data folder for taskwarrior-tui' -r
complete -c taskwarrior-tui -s c -l config -d 'Sets the config folder for taskwarrior-tui' -r
complete -c taskwarrior-tui -l taskdata -d 'Sets the .task folder using the TASKDATA environment variable for taskwarrior' -r
complete -c taskwarrior-tui -l taskrc -d 'Sets the .taskrc file using the TASKRC environment variable for taskwarrior' -r
complete -c taskwarrior-tui -s r -l report -d 'Sets default report' -r
complete -c taskwarrior-tui -s h -l help -d 'Print help information'
complete -c taskwarrior-tui -s V -l version -d 'Print version information'