f4435a4522c1070b04d4e3a5b6b705bcebc309e5

Author
Zacharias Knudsen <z@chari.as>
Committer
GitHub <noreply@github.com>
Date

Message

feat(rails): update completion script (#12145)

Source: https://github.com/zsh-users/zsh-completions/blob/f7c3173886f4f56bf97d622677c6d46ab005831f/src/_rails

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/rails/_rails b/plugins/rails/_rails
  2index ac90d45cc4650b0094cf8348b8e98481b11c3e1c..48fd1909ea3252e2b11c86b40a043d26595992cc 100644
  3--- a/plugins/rails/_rails
  4+++ b/plugins/rails/_rails
  5@@ -1,6 +1,6 @@
  6 #compdef rails
  7 # ------------------------------------------------------------------------------
  8-# Copyright (c) 2016 GitHub zsh-users - http://github.com/zsh-users
  9+# Copyright (c) 2016 GitHub zsh-users - https://github.com/zsh-users
 10 # All rights reserved.
 11 #
 12 # Redistribution and use in source and binary forms, with or without
 13@@ -28,589 +28,503 @@
 14 # Description
 15 # -----------
 16 #
 17-#  Completion script for Ruby on Rails (http://rubyonrails.org/).
 18+#  Completion script for Ruby on Rails 7.1.0 (https://rubyonrails.org/).
 19 #
 20 # ------------------------------------------------------------------------------
 21 # Authors
 22 # -------
 23 #
 24 #  * Kazuya Takeshima (https://github.com/mitukiii)
 25+#  * Shohei Yoshida (https://github.com/syohex)
 26 #
 27 # ------------------------------------------------------------------------------
 28 
 29-
 30 _rails() {
 31-  local context state line curcontext="$curcontext"
 32-
 33-  if (( CURRENT > 2 )); then
 34-    (( CURRENT-- ))
 35-    shift words
 36-    _call_function - "_rails_${words[1]}" || _nothing
 37-  else
 38-    __rails_commands
 39-  fi
 40-}
 41-
 42-__rails_commands() {
 43-  local context state line curcontext="$curcontext"
 44-
 45-  local -a rails_options
 46-  __rails_setup_rails_options
 47-
 48-  _arguments -C \
 49-    $rails_options \
 50-    ': :->command'
 51-
 52-  case "$state" in
 53-    command)
 54-      local -a commands
 55-      local application_directory
 56-      __rails_setup_application_directory
 57-
 58-      if [ -n "$application_directory" ]; then
 59-        commands=(
 60-          {generate,g}'[Generate new code]'
 61-          {console,c}'[Start the Rails console]'
 62-          {server,s}'[Start the Rails server]'
 63-          {dbconsole,db}'[Start a console for the database specified in config/database.yml]'
 64-          application'[Generate the Rails application code]'
 65-          {destroy,d}'[Undo code generated with "generate"]'
 66-          benchmarker'[See how fast a piece of code runs]'
 67-          profiler'[Get profile information from a piece of code]'
 68-          plugin'[Install a plugin]'
 69-          {runner,r}'[Run a piece of code in the application environment]'
 70-          {test,t}'[Run tests]'
 71-        )
 72-      else
 73-        commands=(
 74-          new'[Create a new Rails application]'
 75-        )
 76-      fi
 77-
 78-      _values 'command' $commands
 79-      ;;
 80-  esac
 81-}
 82+  local context state state_descr line curcontext="$curcontext"
 83+  typeset -A opt_args
 84 
 85-__rails_setup_application_directory() {
 86-  application_directory="$(pwd)"
 87-
 88-  while [ -n "$application_directory" ]; do
 89-    if [ -f "${application_directory}/script/rails" -o -f "${application_directory}/bin/rails" ]; then
 90-      return
 91-    fi
 92-    application_directory="${application_directory%/*}"
 93-  done
 94-
 95-  application_directory=
 96-}
 97-
 98-__rails_setup_rails_options() {
 99-  rails_options=(
100-    {-h,--help}'[Show this help message and quit]'
101-    {-v,--version}'[Show Rails version number and quit]'
102+  local -a runtime_options rails_options
103+  runtime_options=(
104+    '(- *)'{-h,--help}'[Show this help message and quit]'