Parent directory

_powify

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