_rails
23940 bytes
1#compdef rails
2# ------------------------------------------------------------------------------
3# Copyright (c) 2016 GitHub zsh-users - https://github.com/zsh-users
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are met:
8# * Redistributions of source code must retain the above copyright
9# notice, this list of conditions and the following disclaimer.
10# * Redistributions in binary form must reproduce the above copyright
11# notice, this list of conditions and the following disclaimer in the
12# documentation and/or other materials provided with the distribution.
13# * Neither the name of the zsh-users nor the
14# names of its contributors may be used to endorse or promote products
15# derived from this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
21# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27# ------------------------------------------------------------------------------
28# Description
29# -----------
30#
31# Completion script for Ruby on Rails 7.1.0 (https://rubyonrails.org/).
32#
33# ------------------------------------------------------------------------------
34# Authors
35# -------
36#
37# * Kazuya Takeshima (https://github.com/mitukiii)
38# * Shohei Yoshida (https://github.com/syohex)
39#
40# ------------------------------------------------------------------------------
41
42_rails() {
43 local context state state_descr line curcontext="$curcontext"
44 typeset -A opt_args
45
46 local -a runtime_options rails_options
47 runtime_options=(
48 '(- *)'{-h,--help}'[Show this help message and quit]'
49 '(- *)'{-v,--version}'[Show Rails version and quit]'
50 )
51
52 runtime_options=(
53 '(-f --force)'{-f,--force}'[Overwrite files that already exist]'
54 '(-p --pretend)'{-p,--pretend}'[Run but do not make any changes]'
55 '(-q --quiet)'{-q,--quiet}'[Suppress status output]'
56 '(-s --skip)'{-s,--skip}'[Skip files that already exist]'
57 )
58
59 local ret=1
60
61 _arguments -C \
62 $rails_options \
63 '1: :_rails_subcommands' \
64 '*:: :->command' && ret=0
65
66 case "$state" in
67 (command)
68 case $words[1] in
69 (new)
70 _rails_new && ret=0
71 ;;
72 (generate|g|destroy|d)
73 _rails_generate && ret=0
74 ;;
75 (console|c)
76 _arguments \
77 '(- *)'{-h,--help}'[Show this help message and quit]' \
78 '(-e --environment)'{-e,--environment=}'[The environment to run "console" in]:env:(test development production)' \
79 '(-s --sandbox)'{-s,--sandbox}'[Rollback database modifications on exit]' \
80 && ret=0
81 ;;
82 (server|s)
83 _arguments \
84 '(- *)'{-h,--help}'[Show this help message and quit]' \
85 '(-e --environment)'{-e,--environment=}'[The environment to run "server" in]:env:(test development production)' \
86 '(-p --port)'{-p,--port}'[Run Rails on the specified port]:port' \
87 '(-b --binding)'{-b,--binding=}'[Bind Rails to the specified IP]:binding' \
88 '(-c --config)'{-c,--config=}'[Use a custom rackup configuration]:config file:_files -g "*.ru"' \
89 '(-d --daemon)'{-d,--daemon}'[Run server as a Daemon]' \
90 '(-u --using)'{-u,--using=}'[Specify the Rack server used to run the application]:server:(thin puma webrick)' \
91 '(-P --pid)'{-P,--pid=}'[Specify the PID file]:pid file:_files -g "*.pid"' \
92 '(-C --dev-caching --no-dev-caching)'{-C,--dev-caching}'[Perform caching in development]' \
93 '(-C --dev-caching --no-dev-caching)--no-dev-caching[Not perform caching in development]' \
94 '--early-hints[Enable HTTP/2 early hints]' \
95 '(--log-to-stdout --no-log-to-stdout)--log-to-stdout[Log to stdout]' \
96 '(--log-to-stdout --no-log-to-stdout)--no-log-to-stdout[Not log to stdout]' \
97 && ret=0
98 ;;
99 (dbconsole|db)
100 _arguments \
101 '(- *)'{-h,--help}'[Show this help message and quit]' \
102 '(-e --environment)'{-e,--environment=}'[The environment to run "server" in]:env:(test development production)' \
103 '(-p --include-password)'{-p,--include-password}'[Automatically provide the password from database.yml]' \
104 '--mode=[Automatically put the sqlite3 database in the specified mode]:mode:(html list line column)' \
105 '(--header --no-header)--header[Display header]' \
106 '(--header --no-header)--no-header[Not display header]' \
107 '(--db --database)'{--db=,--database=}'[Specify the database to use]:database:_files' \
108 && ret=0
109 ;;
110 (test|t|test:system)
111 _arguments \
112 '(- *)'{-h,--help}'[Show this help message and quit]' \
113 '--no-plugins[Bypass minitest plugin auto-loading]' \
114 '(-s --seed)'{-s,--seed=}'[Sets random seed]:seed' \
115 '(-v -verbose)'{-v,--verbose}'[Show progress processing files]' \
116 '--show-skips[Show skipped at the end of run]' \
117 \*{-n,--name=}'[Filter run on /regexp/ or string]:pattern' \
118 *--exclude='[Exclude /regexp/ or string from run]:pattern' \
119 \*{-S,--skip=}'[Skip reporting of certain types of results]' \
120 '(-w --warnings)'{-w,--warnings}'[Run with Ruby warnings enabled]' \
121 '(-e --environment)'{-e,--environment=}'[Run tests in the given environment]' \
122 '(-b --backtrace)'{-b,--backtrace}'[Show the complete backtrace]' \
123 '(-d --defer-output)'{-d,--defer-output}'[Output test failures and errors after the test run]' \
124 '(-f --fail-fast)'{-f,--fail-fast}'[Abort test run on first failure or error]' \
125 '(-c --color --no-color)'{-c,--color}'[Enable color in the output]' \
126 '(-c --color --no-color)--no-color[Disable color in the output]' \
127 '--profile=[Enable profiling of tests and list the slowest test cases]:count' \
128 '(-p --pride)'{-p,--pride}'[Show your testing pride]' \
129 '*:: :_files -g "*.rb"' \
130 && ret=0
131 ;;
132 (runner|r)
133 _arguments \
134 '(- *)'{-h,--help}'[Show this help message and quit]' \
135 '(-e --environment)'{-e,--environment=}'[The environment to run "runner"]:env:(test development production)' \
136 '*:: :_files -g "*.rb"' \
137 && ret=0
138 ;;
139 (plugin)
140 _arguments \
141 '1: :(new)' \
142 '*:: :_rails_new' \
143 && ret=0
144 ;;
145 (routes)
146 _arguments \
147 '(- *)'{-h,--help}'[Show this help message and quit]' \
148 '(-c --controller)'{-c,--controller=}'[Filter by a specific controller]:controller' \
149 '(-g --grep)'{-g,--grep}'[Grep routes by a specific pattern]' \
150 '(-E --expanded)'{-E,--expanded}'[Print routes expanded vertically with parts explained]' \
151 '(-u --unused)'{-u,--unused}'[Print unused routes]' \
152 && ret=0
153 ;;
154 (*)
155 _arguments \
156 '(- *)'{-h,--help}'[Show help message and quit]' \
157 '*:: :_files' \
158 && ret=0
159 ;;
160 esac
161 ;;
162 esac
163
164 return ret
165}
166
167(( $+functions[_rails_subcommands] )) ||
168_rails_subcommands() {
169 local -a commands
170
171 _rails_is_in_app
172
173 if (( $? == 1 )); then
174 # is not in rails app directory
175 commands=(
176 new'[Create a new Rails application]'
177 )
178 else
179 commands=(
180 {generate,g}'[Generate new code]'
181 {console,c}'[Start the Rails console]'
182 {server,s}'[Start the Rails server]'
183 {test,t}'[Run tests]'
184 "test\\:system[Run systems test only]"
185 {dbconsole,db}'[Start a console for the database specified in config/database.yml]'
186 plugin'[Install a plugin]'
187
188 # generated by ./bin/rails --help | ruby -ne '(b=$2;printf("%s[%s]\n", $1.gsub(/:/,"\\:"),b.strip)) if /^([a-z0-9_:]+)\S*\s+([^(\n]+)/'
189 "about[List versions of all Rails frameworks and the environment]"
190 "action_mailbox\:ingress\:exim[Relay an inbound email from Exim to Action Mailbox]"
191 "action_mailbox\:ingress\:postfix[Relay an inbound email from Postfix to Action Mailbox]"
192 "action_mailbox\:ingress\:qmail[Relay an inbound email from Qmail to Action Mailbox]"
193 "action_mailbox\:install[Install Action Mailbox and its dependencies]"
194 "action_mailbox\:install\:migrations[Copy migrations from action_mailbox to application]"
195 "action_text\:install[Copy over the migration, stylesheet, and JavaScript files]"
196 "action_text\:install\:migrations[Copy migrations from action_text to application]"
197 "active_storage\:install[Copy over the migration needed to the application]"
198 "app\:template[Apply the template supplied by LOCATION=]"
199 "app\:update[Update configs and some other initially generated files]"
200 "assets\:clean[Remove old compiled assets]"
201 "assets\:clobber[Remove compiled assets]"
202 "assets\:environment[Load asset compile environment]"
203 "assets\:precompile[Compile all the assets named in config.assets.precompile]"
204 "cache_digests\:dependencies[Lookup first-level dependencies for TEMPLATE]"
205 "cache_digests\:nested_dependencies[Lookup nested dependencies for TEMPLATE]"
206 "credentials\:diff[Enroll/disenroll in decrypted diffs of credentials using git]"
207 "credentials\:edit[Open the decrypted credentials in $VISUAL or $EDITOR for editing]"
208 "credentials\:show[Show the decrypted credentials]"
209 "db\:create[Create the database from DATABASE_URL or config/database.yml for the current RAILS_ENV]"
210 "db\:drop[Drop the database from DATABASE_URL or config/database.yml for the current RAILS_ENV]"
211 "db\:encryption\:init[Generate a set of keys for configuring Active Record encryption in a given environment]"
212 "db\:environment\:set[Set the environment value for the database]"
213 "db\:fixtures\:load[Load fixtures into the current environment's database]"
214 "db\:migrate[Migrate the database]"
215 "db\:migrate\:down[Run the 'down' for a given migration VERSION]"
216 "db\:migrate\:redo[Roll back the database one migration and re-migrate up]"
217 "db\:migrate\:reset[Drop and recreate all databases from scratch for the current environment]"
218 "db\:migrate\:status[Display status of migrations]"
219 "db\:migrate\:up[Run the 'up' for a given migration VERSION]"
220 "db\:prepare[Run setup if database does not exist, or run migrations if it does]"
221 "db\:reset[Drop and recreate all databases from their schema for the current environment and load the seeds]"
222 "db\:rollback[Roll the schema back to the previous version]"
223 "db\:schema\:cache\:clear[Clear a db/schema_cache.yml file]"
224 "db\:schema\:cache\:dump[Create a db/schema_cache.yml file]"
225 "db\:schema\:dump[Create a database schema file]"
226 "db\:schema\:load[Load a database schema file]"
227 "db\:seed[Load the seed data from db/seeds.rb]"
228 "db\:seed\:replant[Truncate tables of each database for current environment and load the seeds]"
229 "db\:setup[Create all databases, load all schemas, and initialize with the seed data]"
230 "db\:system\:change[Change 'config/database.yml' and your database gem to the target database]"
231 "db\:version[Retrieve the current schema version number]"
232 "destroy[Remove code generated by 'bin/rails generate']"
233 "dev\:cache[Toggle development mode caching on/off]"
234 "encrypted\:edit[Open the decrypted file in $VISUAL or $EDITOR for editing]"
235 "encrypted\:show[Show the decrypted contents of the file]"
236 "importmap\:install[Setup Importmap for the app]"
237 "initializers[Print out all defined initializers in the order they are invoked by Rails.]"
238 "log\:clear[Truncate all/specified *.log files in log/ to zero bytes]"
239 "middleware[Print out your Rack middleware stack]"
240 "notes[Show comments in your code annotated with FIXME, OPTIMIZE, and TODO]"
241 "restart[Restart app by touching tmp/restart.txt]"
242 "routes[List all the defined routes]"
243 "runner[Run Ruby code in the context of your application]"
244 "secret[Generate a cryptographically secure secret key]"
245 "secrets\:edit[**deprecated** Open the secrets in $VISUAL or $EDITOR for editing]"
246 "secrets\:show[**deprecated** Show the decrypted secrets]"
247 "stats[Report code statistics]"
248 "stimulus\:install[Install Stimulus into the app]"
249 "stimulus\:install\:importmap[Install Stimulus on an app running importmap-rails]"
250 "stimulus\:install\:node[Install Stimulus on an app running node]"
251 "test\:all[Run all tests, including system tests]"
252 "test\:channels[Run tests in test/channels]"
253 "test\:controllers[Run tests in test/controllers]"
254 "test\:db[Reset the database and run 'bin/rails test']"
255 "test\:functionals[Run tests in test/controllers, test/mailers, and test/functional]"
256 "test\:generators[Run tests in test/lib/generators]"
257 "test\:helpers[Run tests in test/helpers]"
258 "test\:integration[Run tests in test/integration]"
259 "test\:jobs[Run tests in test/jobs]"
260 "test\:mailboxes[Run tests in test/mailboxes]"
261 "test\:mailers[Run tests in test/mailers]"
262 "test\:models[Run tests in test/models]"
263 "test\:units[Run tests in test/models, test/helpers, and test/unit]"
264 "time\:zones[List all time zones, list by two-letter country code]"
265 "tmp\:clear[Clear cache, socket and screenshot files from tmp/]"
266 "tmp\:create[Create tmp directories for cache, sockets, and pids]"
267 "turbo\:install[Install Turbo into the app]"
268 "turbo\:install\:importmap[Install Turbo into the app with asset pipeline]"
269 "turbo\:install\:node[Install Turbo into the app with webpacker]"
270 "turbo\:install\:redis[Switch on Redis and use it in development]"
271 "version[Show the Rails version]"
272 "yarn\:install[Install all JavaScript dependencies as specified via Yarn]"
273 "zeitwerk\:check[Check project structure for Zeitwerk compatibility]"
274 )
275 fi
276
277 _values 'command' $commands
278}
279
280# rails new
281(( $+functions[_rails_new] )) ||
282_rails_new() {
283 local ret=1
284
285 _arguments \
286 $runtime_options \
287 $rails_options \
288 --skip-namespace'[Skip namespace]' \
289 '(-n --name)'{-n,--name=}'[Name of the app]:name' \
290 '(-r --ruby)'{-r,--ruby=}'[Path to the Ruby binary of your choice]:path:_files' \
291 '(-b --builder)'{-b,--builder=}'[Path to a application builder(can be a filesystem path or URL)]: :_rails_path_or_url' \
292 '(-m --template)'{-m,--template=}'[Path to an application template(can be a filesystem path or URL)]: :_rails_path_or_url' \
293 '(-d --database)'{-d,--database=}'[Preconfigure for selected database]:database:(mysql trilogy oracle postgresql sqlite3 frontbase ibm_db sqlserver jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc)' \
294 --skip-gemfile"[Don't create a Gemfile]" \
295 --skip-bundle"[Don't run bundle install]" \
296 '(-G --skip-git)'{-G,--skip-git}'[Skip git init]' \
297 --skip-docker'[Skip Dockerfile]' \
298 --skip-keeps'[Skip source control .keep files]' \
299 '(-M --skip-action-mailer)'{-M,--skip-action-mailer}'[Skip Action Mailer files]' \
300 --skip-action-mailbox'[Skip Action Mailbox gem]' \
301 --skip-action-text'[Skip Action Text gem]' \
302 '(-O --skip-active-record)'{-O,--skip-active-record}'[Skip Active Record files]' \
303 --skip-active-job'[Skip Active Job]' \
304 --skip-active-storage'[Skip Active Storage files]' \
305 '(-C --skip-action-cable)'{-C,--skip-action-cable}'[Skip Action Cable files]' \
306 '(-A --skip-asset-pipeline)'{-A,--skip-asset-pipeline}'[Skip asset pipeline]' \
307 '(-a --asset-pipeline)'{-a,--asset-pipeline=}'[Choose your asset pipeline]:asset pipeline:(sprockets propshaft)' \
308 '(-J --skip-js)'{-J,--skip-js}'[Skip JavaScript files]' \
309 --skip-hotwire'[Skip Hotwire integration]' \
310 --skip-jbuilder'[Skip jbuilder gem]' \
311 '(-T --skip-test)'{-T,--skip-test}'[Skip test files]' \
312 --skip-system-test'[Skip system test files]' \
313 --skip-bootsnap'[Skip bootsnap gem]' \
314 --skip-dev-gems'[Skip development gems(e.g. web-console)]' \
315 --dev'[Setup the application with Gemfile pointing to your Rails checkout]' \
316 --edge'[Setup the application with Gemfile pointing to Rails repository]' \
317 --master'[Set up the application with Gemfile pointing to Rails repository main branch]' \
318 --rc='[Path to file containing extra configuration options for rails command]:rc:_files' \
319 --api'[Preconfigure smaller stack for API only apps]' \
320 --minimal'[Preconfigure a minimal rails app]' \
321 '(-j --js)'{-j,--js=}'[Choose JavaScript approach]:javascript:(importmap bun webpack esbuild rollup)' \
322 '(-c --css)'{-c,--css=}'[Choose CSS processor]:css processor:(tailwind bootstrap bulma postcss sass)' \
323 '(-B --skip-bundle)'{-B,--skip-bundle}"[Don't run bundle install]" \
324 --skip-decrypted-diffs"[Don't configure git to show decrypted diffs of encrypted credentials]" \
325 ':app path:_directories' && ret=0
326
327 return ret
328}
329
330# rails generate
331(( $+functions[_rails_generate] )) ||
332_rails_generate() {
333 local ret=1
334
335 _arguments -C \
336 '(- *)'{-h,--help}"[Print generator's options and usage]" \
337 $runtime_options \
338 '1:generator:_rails_generate_generator' \
339 '*:: :->generate' && ret=0
340
341 case "$state" in
342 (generate)
343 local -a opts
344 opts=(
345 '(- *)'{-h,--help}'[Show this help message and quit]'
346 $runtime_options
347 '--skip-namespace[Skip namespace]'
348 '--skip-collision-check[Skip collision check]'
349 )
350
351 case $words[1] in
352 (application_record|migration|model|resource|scaffold|scaffold_controller)
353 opts+=(
354 '(-o --orm)'{-o,--orm=}'[ORM to be invoked]:orm:(active_record)'
355 )
356 ;|
357 (channel)
358 opts+=(
359 '--no-assets[Not generate assets]'
360 )
361 ;|
362 (controller|resource|scaffold|scaffold_controller)
363 opts+=(
364 '--skip-routes[Do not add routes to config/routes.rb]'
365 '--no-helper[Not generate helper]'
366 )
367 ;|
368 (controller|job|model|resource|scaffold)
369 opts+=(
370 '--parent=[The parent class for the generated controller]:parent class'
371 )
372 ;|
373 (controller|mailer|resource|scaffold|scaffold_controller)
374 opts+=(
375 '(-e --template-engine)'{-e,--template-engine=}'[Template engine to be invoked]:engine:(erb)'
376 )
377 ;|
378 (channel|controller|generator|helper|job|mailbox|mailer|model|scaffold|scaffold_controller)
379 opts+=(
380 '(-t --test-framework)'{-t,--test-framework=}'[Test framework to be invoked]:test_framework:(test_unit)'
381 )
382 ;|
383 (generator|test_unit:channel)
384 opts+=(
385 '--no-namespace[Not generate namespace generate]'
386 )
387 ;|
388 (integration_test)
389 opts+=(
390 '--integration-tool=[Integration tool to be invoked]:tool:(test_unit)'
391 )
392 ;|
393 (jbuilder|resource|scaffold|scaffold_controller)
394 opts+=(
395 '--model-name=[ModelName to be used]:name'
396 )
397 ;|
398 (jbuilder|model|resource|scaffold|scaffold_controller)
399 opts+=(
400 '--force-plural[Do not singularize the model name]'
401 )
402 ;|
403 (jbuilder|migration|model|resource|scaffold_controller)
404 opts+=(
405 '--no-timestamps[Not generate timestamps]'
406 )
407 ;|
408 (job)
409 opts+=(
410 '--queue=[The queue name for the generated job]:name'
411 )
412 ;|
413 (migration|model|resource|scaffold)
414 opts+=(
415 '--primary-key-type=[The type for primary key]'
416 '(--db --database)'{--db,--database=}'[The database for your migration]:db'
417 )
418 ;|
419 (model|resource|scaffold)
420 opts+=(
421 '--no-migration[Not generate migration]'
422 '--no-indexes[Not add indexes for references and belongs_to columns]'
423 '--no-fixture[Not generate fixture]'
424 '(-r --fixture-replacement)'{-r,--fixture-replacement=}'[Fixture replacement to be invoked]:fixture'
425 )
426 ;|
427 (resource)
428 opts+=(
429 '(-c --resource-controller)'{-c,--resource-controller=}'[Resource controller to be invoked]:controller:(controller)'
430 '(-a --actions)'{-a,--actions=}'[Actions for the source controller]:action'
431 )
432 ;|
433 (resource|scaffold|scaffold_controller)
434 opts+=(
435 '--no-resource-route[Not generate resource route]'
436 )
437 ;|
438 (scaffold)
439 opts+=(
440 '(-c --scaffold-controller)'{-c,--scaffold-controller=}'[Scaffold controller to be invoked]:controller:(scaffold_controller)'
441
442 )
443 ;|
444 (scaffold|scaffold_controller)
445 opts+=(
446 '--api[Generate API-only controller and tests, with no view templates]'
447 '--no-jbuilder[Not generate jbuilder]'
448 )
449 ;|
450 (scaffold|scaffold_controller|system_test)
451 opts+=(
452 '--system-tests=[System test framework to be invoked]:framework:(test_unit)'
453 )
454 ;|
455 (stimulus)
456 opts+=(
457 '--skip-manifest[Do not update the stimulus manifest]'
458 )
459 ;|
460 (jbuilder|migration|resource|scaffold)
461 opts+=(
462 '*:field:_rails_migration_fields'
463 )
464 ;|
465 esac
466
467 _arguments $opts && ret=0
468 ;;
469 esac
470
471 return ret
472}
473
474(( $+functions[_rails_generate_generator] )) ||
475_rails_generate_generator() {
476 local -a generators=(
477 # rails
478 application_record benchmark channel controller generator helper integration_test
479 jbuilder job mailbox mailer migration model resource scaffold scaffold_controller
480 system_test task
481
482 # active record
483 "active_record\\:application_record"
484 "active_record\\:multi_db"
485
486 # Stimulus
487 stimulus
488
489 # TestUnit
490 "test_unit\\:channel" "test_unit\\:generator" "test_unit\\:install"
491 "test_unit\\:mailbox" "test_unit\\:plugin"
492 )
493
494 _values 'generators' $generators
495}
496
497# Utilities
498(( $+functions[_rails_is_in_app] )) ||
499_rails_is_in_app() {
500 local dir="$PWD"
501 while [ -n "$dir" ]; do
502 if [[ -f "${dir}/bin/rails" ]]; then
503 return 0
504 fi
505 dir="${dir/*}"
506 done
507
508 return 1
509}
510
511(( $+functions[_rails_path_or_url] )) ||
512_rails_path_or_url() {
513 _alternative \
514 'files:path:_files -g "*.rb"' \
515 'url:url:_urls'
516}
517
518(( $+functions[_rails_migration_fields] )) ||
519_rails_migration_fields() {
520 if compset -P '*:*:'; then
521 _values 'index' 'index' 'uniq'
522 else
523 if compset -P '*:'; then
524 _values -s ':' 'type' 'string' 'text' 'integer' 'float' 'decimal' 'datetime' 'timestamp' 'time' 'date' 'binary' 'boolean' 'references'
525 else
526 _guard '[[:alnum:]_]#' 'field'
527 fi
528 fi
529}
530
531_rails "$@"
532
533# Local Variables:
534# mode: Shell-Script
535# sh-indentation: 2
536# indent-tabs-mode: nil
537# sh-basic-offset: 2
538# End:
539# vim: ft=zsh sw=2 ts=2 et