mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Added basic tab completion for Rails 3 commands.
This commit is contained in:
parent
72d5ec8849
commit
fbfcaccff9
2 changed files with 58 additions and 0 deletions
54
plugins/rails3/_rails3
Normal file
54
plugins/rails3/_rails3
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
#compdef rails
|
||||||
|
#autoload
|
||||||
|
|
||||||
|
# rails 3 zsh completion, based on homebrew completion
|
||||||
|
|
||||||
|
local -a _1st_arguments
|
||||||
|
_1st_arguments=(
|
||||||
|
'generate:Generate new code (short-cut alias: "g")'
|
||||||
|
'console:Start the Rails console (short-cut alias: "c")'
|
||||||
|
'server:Start the Rails server (short-cut alias: "s")'
|
||||||
|
'dbconsole:Start a console for the database specified in config/database.yml (short-cut alias: "db")'
|
||||||
|
'new:Create a new Rails application. "rails new my_app" creates a new application called MyApp in "./my_app"'
|
||||||
|
'application:Generate the Rails application code'
|
||||||
|
'destroy:Undo code generated with "generate"'
|
||||||
|
'benchmarker:See how fast a piece of code runs'
|
||||||
|
'profiler:Get profile information from a piece of code'
|
||||||
|
'plugin:Install a plugin'
|
||||||
|
)
|
||||||
|
|
||||||
|
_rails_generate_arguments() {
|
||||||
|
generate_arguments=(
|
||||||
|
controller
|
||||||
|
generator
|
||||||
|
helper
|
||||||
|
integration_test
|
||||||
|
mailer
|
||||||
|
migration
|
||||||
|
model
|
||||||
|
observer
|
||||||
|
performance_test
|
||||||
|
plugin
|
||||||
|
resource
|
||||||
|
scaffold
|
||||||
|
scaffold_controller
|
||||||
|
session_migration
|
||||||
|
stylesheets
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
_arguments \
|
||||||
|
'(--version)--version[show version]' \
|
||||||
|
'(--help)--help[show help]' \
|
||||||
|
'*:: :->subcmds' && return 0
|
||||||
|
|
||||||
|
if (( CURRENT == 1 )); then
|
||||||
|
_describe -t commands "rails subcommand" _1st_arguments
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$words[1]" in
|
||||||
|
generate)
|
||||||
|
_rails_generate_arguments
|
||||||
|
_wanted generate_arguments expl 'all generate' compadd -a generate_arguments ;;
|
||||||
|
esac
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
fpath=($ZSH/plugins/rails3 $fpath)
|
||||||
|
autoload -U compinit
|
||||||
|
compinit -i
|
||||||
|
|
||||||
alias rs='ruby script/rails server'
|
alias rs='ruby script/rails server'
|
||||||
alias rg='ruby script/rails generate'
|
alias rg='ruby script/rails generate'
|
||||||
alias rd='ruby script/rails destroy'
|
alias rd='ruby script/rails destroy'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue