anchor.diff:          <%=sname%>:''
         <%-end-%>
         )
  -			_describe -t commands 'subcommsnd' subcommands
  +			_describe -t commands 'subcommand' subcommands
         <%-end-%>
  +      _describe -t options 'global options' __<%= program :name %>_common_options
         <%- unless command.nil? then -%>
         _arguments \
           <%- for option in command.options -%>
  
positive.code: #compdef <%= program :name %>
  
  
  _<%= program :name %> () {
      local curcontext="$curcontext" state line common_options
      typeset -A opt_args
  
      common_options=(
      <% for option in @options -%>
        <%- if flatswitches(option).count > 1 -%>
          {<%= flatswitches(option).join(',') %>}<%= takesArg(option) %>"[<%= optionDesc option %>]: :"
        <%- else -%>
          "<%= flatswitches(option).first %><%= takesArg(option) %>[<%= optionDesc option %>]: :"
        <%- end -%>
      <% end %>
      )
      # except this fails when a command only has one arg and then options.
      _arguments -C \
          ':command:->command' \
  
negative.code:             "<%= flatswitches(option).first %><%= takesArg(option) %>[<%= optionDesc option %>]: :" \
            <%- end -%>
          <%- end -%>
        <%- end %>
      ;;
      (options)
        case $line[1] in
        <%- for sname, ssubs in subs -%>
          <%- command = ssubs["\0cmd"]; subs = ssubs.reject{|k,_| k == "\0cmd"} -%>
          (<%=sname%>)
          <%- unless command.nil? then -%>
            _arguments \
            <%- for option in command.options -%>
              <%- if flatswitches(option).count > 1 -%>
                {<%= flatswitches(option).join(',') %>}<%= takesArg(option) %>"[<%= optionDesc option %>]: :" \
              <%- else -%>
                "<%= flatswitches(option).first %><%= takesArg(option) %>[<%= optionDesc option %>]: :" \
              <%- end -%>
            <%- end -%>
          <%- end %>
          ;;
        <%-end-%>
        esac
  