8d6b7573e77abf2fb114579806e6e749bef5eca5

Author
Rostislav Raykov <z@zbrox.org>
Committer
Rostislav Raykov <z@zbrox.org>
Date

Message

Powify autocomplete

Diff

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