Add autocompletion for Rails3.
+ Originally published by Christopher Chow.
+ Source:
https://github.com/robbyrussell/oh-my-zsh/blob/30620d463850c17f86e7a56fbf6a8b5e793a4e07/plugins/rails3/_rails3
Commit: 30620d463850c17f86e7a56fbf6a8b5e793a4e07
Diff
1diff --git a/plugins/rails3/_rails3 b/plugins/rails3/_rails3
2new file mode 100644
3index 0000000000000000000000000000000000000000..97915e68b90cd84cca1ff24e3b6b175224e4eab3
4--- /dev/null
5+++ b/plugins/rails3/_rails3
6@@ -0,0 +1,56 @@
7+#compdef rails
8+#autoload
9+
10+# rails 3 zsh completion, based on homebrew completion
11+# Extracted from https://github.com/robbyrussell/oh-my-zsh/blob/30620d463850c17f86e7a56fbf6a8b5e793a4e07/plugins/rails3/_rails3
12+# Published by Christopher Chow
13+
14+local -a _1st_arguments
15+_1st_arguments=(
16+ 'generate:Generate new code (short-cut alias: "g")'
17+ 'console:Start the Rails console (short-cut alias: "c")'
18+ 'server:Start the Rails server (short-cut alias: "s")'
19+ 'dbconsole:Start a console for the database specified in config/database.yml (short-cut alias: "db")'
20+ 'new:Create a new Rails application. "rails new my_app" creates a new application called MyApp in "./my_app"'
21+ 'application:Generate the Rails application code'
22+ 'destroy:Undo code generated with "generate"'
23+ 'benchmarker:See how fast a piece of code runs'
24+ 'profiler:Get profile information from a piece of code'
25+ 'plugin:Install a plugin'
26+)
27+
28+_rails_generate_arguments() {
29+ generate_arguments=(
30+ controller
31+ generator
32+ helper
33+ integration_test
34+ mailer
35+ migration
36+ model
37+ observer
38+ performance_test
39+ plugin
40+ resource
41+ scaffold
42+ scaffold_controller
43+ session_migration
44+ stylesheets
45+ )
46+}
47+
48+_arguments \
49+ '(--version)--version[show version]' \
50+ '(--help)--help[show help]' \
51+ '*:: :->subcmds' && return 0
52+
53+if (( CURRENT == 1 )); then
54+ _describe -t commands "rails subcommand" _1st_arguments
55+ return
56+fi
57+
58+case "$words[1]" in
59+ generate)
60+ _rails_generate_arguments
61+ _wanted generate_arguments expl 'all generate' compadd -a generate_arguments ;;
62+esac