Bash completion script, list-projects, list-contexts commands.
* list-projects lists all the projects in the repo. * list-contexts lists all the context in the repo. * Created a bash completion script to allow auto-complete for GTD.
This commit is contained in:
39
resources/etc/bash_completion.d/gtd
Normal file
39
resources/etc/bash_completion.d/gtd
Normal file
@ -0,0 +1,39 @@
|
||||
_gtd()
|
||||
{
|
||||
local cur prev topOpts debugOpts logLevels
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
topOpts="help process done calendar list-copies new tickler list debug delegate rename-project list-projects list-contexts"
|
||||
debugOpts="state loglevel"
|
||||
logLevels="TRACE DEBUG INFO WARN ERROR"
|
||||
|
||||
case "${prev}" in
|
||||
help)
|
||||
COMPREPLY=( $(compgen -W "${topOpts}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
done|list-copies|delegate)
|
||||
COMPREPLY=( $(compgen -f ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
ls|list)
|
||||
COMPREPLY=( $(gtd list-projects) $(gtd list-contexts) )
|
||||
return 0
|
||||
;;
|
||||
debug)
|
||||
COMPREPLY=( $(compgen -W "${debugOpts}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
loglevel)
|
||||
COMPREPLY=( $(compgen -W "${logLevels}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
COMPREPLY=( $(compgen -W "${topOpts}" -- ${cur}) )
|
||||
return 0
|
||||
}
|
||||
complete -F _gtd gtd
|
Reference in New Issue
Block a user