_terminitor 1013 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #compdef terminitor
  2. #autoload
  3. # terminitor zsh completion
  4. _terminitor_available_scripts() {
  5. scripts=(`for SCRIPT in ~/.config/terminitor/*.term ; do basename $SCRIPT .term ; done`)
  6. }
  7. local -a _1st_arguments
  8. _1st_arguments=(
  9. 'create:create a Termfile in directory'
  10. 'delete:delete terminitor script'
  11. 'edit:open termitor script'
  12. 'fetch:clone the designated repo and run setup'
  13. 'help:Describe available tasks or one specific task'
  14. 'init:create initial root terminitor folder'
  15. 'list:lists all terminitor scripts'
  16. 'setup:execute setup in the terminitor script'
  17. 'start:runs the terminitor script'
  18. 'update:update Terminitor to new global path(.config/.terminitor)'
  19. )
  20. local expl
  21. _arguments \
  22. '*:: :->subcmds' && return 0
  23. if (( CURRENT == 1 )); then
  24. _describe -t commands "terminitor task" _1st_arguments
  25. return
  26. fi
  27. case "$words[1]" in
  28. start|edit|delete|setup)
  29. _terminitor_available_scripts
  30. _wanted scripts expl 'installed scripts' compadd -a scripts ;;
  31. esac