Update generate and destroy completions

This commit is contained in:
Shohei YOSHIDA 2023-09-28 16:12:26 +09:00
parent 8068693aee
commit 1a9467fdff
No known key found for this signature in database
GPG Key ID: C9A1BB11BB940CF2
1 changed files with 14 additions and 24 deletions

View File

@ -66,9 +66,9 @@ _rails() {
(command)
case $words[1] in
(new)
__rails_new && ret=0
_rails_new && ret=0
;;
(generate|g)
(generate|g|destroy|d)
_rails_generate && ret=0
;;
(console|c)
@ -95,6 +95,17 @@ _rails() {
'(--log-to-stdout --no-log-to-stdout)--no-log-to-stdout[Not log to stdout]' \
&& ret=0
;;
(dbconsole|db)
_arguments \
'(- *)'{-h,--help}'[Show this help message and quit]' \
'(-e --environment)'{-e,--environment=}'[The environment to run "server" in]:env:(test development production)' \
'(-p --include-password)'{-p,--include-password}'[Automatically provide the password from database.yml]' \
'--mode=[Automatically put the sqlite3 database in the specified mode]:mode:(html list line column)' \
'(--header --no-header)--header[Display header]' \
'(--header --no-header)--no-header[Not display header]' \
'(--db --database)'{--db=,--database=}'[Specify the database to use]:database:_files' \
&& ret=0
;;
esac
;;
esac
@ -119,7 +130,7 @@ _rails_subcommands() {
{console,c}'[Start the Rails console]'
{server,s}'[Start the Rails server]'
{dbconsole,db}'[Start a console for the database specified in config/database.yml]'
{destroy,d}'[Undo code generated with "generate"]'
{destroy,d}'[Remove code generated by "bin/rails generates"]'
plugin'[Install a plugin]'
{runner,r}'[Run a piece of code in the application environment]'
{test,t}'[Run tests]'
@ -389,27 +400,6 @@ __rails_migration_fields() {
fi
}
_rails_dbconsole() {
_arguments \
'(- *)'--help'[Show this help message]' \
'(-p --include-password)'{-p,--include-password}'[Automatically provide the password from database.yml]' \
--mode'[Automatically put the sqlite3 database in the specified mode (html, list, line, column)]:mode:(html list line column)' \
--header
}
_rails_db() {
_rails_dbconsole
}
_rails_destroy() {
_rails_generate
}
_rails_d() {
_rails_destroy
}
_rails_plugin() {
local context state line curcontext="$curcontext"