_powify 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #compdef powify
  2. _powify_all_servers() {
  3. all_servers=(`ls $HOME/.pow/ 2>/dev/null`)
  4. }
  5. local -a all_servers
  6. local -a _1st_arguments
  7. _1st_arguments=(
  8. 'server:server specific commands'
  9. 'utils:manage powify'
  10. 'create:creates a pow app from the current directory (to change the name append name as an argument)'
  11. 'destroy:destroys the pow app linked to the current directory'
  12. 'restart:restarts the pow app linked to the current directory'
  13. 'always_restart:reload the pow app after each request'
  14. 'always_restart_off:do not reload the pow app after each request'
  15. 'rename:rename the current pow app to [NAME] or rename [OLD] to [NEW]'
  16. 'environment:run the this pow app in a different environment (aliased `env`)'
  17. 'browse:opens and navigates the default browser to this app'
  18. 'logs:tail the application logs'
  19. )
  20. _arguments '*:: :->command'
  21. if (( CURRENT == 1 )); then
  22. _describe -t commands "powify command" _1st_arguments
  23. return
  24. fi
  25. case "$words[1]" in
  26. server)
  27. _values , \
  28. 'install[install pow server]' \
  29. 'reinstall[reinstall pow server]' \
  30. 'update[update pow server]' \
  31. 'uninstall[uninstall pow server]' \
  32. 'list[list all pow apps]' \
  33. 'start[start the pow server]' \
  34. 'stop[stop the pow server]' \
  35. 'restart[restart the pow server]' \
  36. 'host[adds all pow apps to /etc/hosts file]' \
  37. 'unhost[removes all pow apps from /etc/hosts file]' \
  38. 'status[print the current server status]' \
  39. 'config[print the current server configuration]' \
  40. 'logs[tails the pow server logs]' ;;
  41. utils)
  42. _values , \
  43. 'install[install powify.dev server management tool]' \
  44. 'reinstall[reinstall powify.dev server management tool]' \
  45. 'uninstall[uninstall powify.dev server management tool]' ;;
  46. destroy|restart|always_restart|always_restart_off|rename|browse|logs)
  47. _powify_all_servers
  48. _wanted all_servers expl 'all pow servers' compadd -a all_servers ;;
  49. esac