Sha256: db404cf69f3134ab7c287142e6ab7818e0953874381cbbfc6c6745ec9484b653

Contents?: true

Size: 1.51 KB

Versions: 25

Compression:

Stored size: 1.51 KB

Contents

<%- if subcommand[:subcommands].any? %>
<%= function_name %>() {
  readonly local DEPTH=<%= depth %>

  case $CURRENT in
    $DEPTH)
      _arguments \
        <%- subcommand[:options].each do |option| -%>
        <%= escape_option_names(option[:names]) %><%= quote(bracket(option[:description])) if option[:description] %> \
        <%- end -%>
        '*: :->subcommands'

      case $state in
        subcommands)
          _values \
            'subcommand' \
            <%- subcommand[:subcommands].each do |subcommand| -%>
            <%= quote(subcommand[:name] + bracket(subcommand[:description])) %> \
            <%- subcommand[:aliases].each do |_alias| -%>
            <%= quote(_alias + bracket(subcommand[:description])) %> \
            <%- end -%>
            <%- end -%>
            ;
          ;;
      esac
      ;;
    *)
      case $words[$DEPTH] in
        <%- subcommand[:subcommands].each do |subcommand| -%>
        <%= subcommand[:name] %>)
          <%= function_name %>_<%= subcommand[:name] %>
          ;;
        <%- subcommand[:aliases].each do |_alias| -%>
        <%= _alias %>)
          <%= function_name %>_<%= subcommand[:name] %>
          ;;
        <%- end -%>
        <%- end -%>
      esac
      ;;
  esac
}
<%- else %>
<%= function_name %>() {
  _arguments \
    <%- subcommand[:options].each do |option| -%>
    <%= escape_option_names(option[:names]) %><%= quote(bracket(option[:description])) if option[:description] %> \
    <%- end -%>
    '*:arg:<%= subcommand[:completer] -%>'
}
<%- end %>

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
autoproj-2.8.4 lib/autoproj/templates/subcommand.zsh.erb
autoproj-2.8.3 lib/autoproj/templates/subcommand.zsh.erb
autoproj-2.8.2 lib/autoproj/templates/subcommand.zsh.erb
autoproj-2.8.1 lib/autoproj/templates/subcommand.zsh.erb
autoproj-2.8.0 lib/autoproj/templates/subcommand.zsh.erb