From 1a9467fdffc88b3406570f2d156c62604da7d3ea Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 28 Sep 2023 16:12:26 +0900 Subject: [PATCH] Update generate and destroy completions --- src/_rails | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/src/_rails b/src/_rails index 93f42ee..71c07a5 100644 --- a/src/_rails +++ b/src/_rails @@ -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"