Sha256: 748ab4d82ec8705883178716290d3948a04e63b993e3b1210a083bd4b1a5b8b7

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

if type <%= completion_command %> 1>/dev/null 2>&1;
then

<%- toplevel_commands(Pione::Command).each do |key1, cmd1| -%>
  #
  # `<%= key1 %>` command
  #

  # set completion function
  <%= completion_exec %> _<%= key1 %> <%= key1 %>

  _<%= key1 %>() {
  <%- if cmd1.subcommand.keys.empty? -%>
    # set option list
    _<%= key1 %>_options
  <%- else -%>
    # setup subcommans list
    local name2="<%= name2 %>"
    local name3="<%= name3 %>"

    case $name2 in
    <%- cmd1.subcommand.each do |key2, cmd2| -%>
      <%- if cmd2.subcommand.empty? -%>
      <%= key2 %>) _<%= key1 %>_<%= key2 %>_options;;
      <%- else -%>
      <%= key2 %>)
        case $name3 in
        <%- cmd2.subcommand.each do |key3, cmd3| -%>
          <%= key3 %>) _<%= key1 %>_<%= key2 %>_<%= key3 %>_options;;
        <%- end -%>
          *) _<%= key1 %>_<%= key2 %>_subcommands;;
        esac;;
      <%- end -%>
    <%- end -%>
      *) _<%= key1 %>_subcommands;;
    esac
  <%- end -%>
  }

  <%- descendants([key1], cmd1).each do |keys, cmd| -%>
  <%- if cmd.subcommand.keys.empty? -%>
  _<%= keys.join("_") %>_options() {
    <%= fun_options(cmd) %>
  }
  <%- else -%>
  _<%= keys.join("_") %>_subcommands() {
     <%= fun_subcommands(cmd) %>
  }
  <%- end -%>

  <%- end -%>
<%- end -%>
fi

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pione-0.5.0 misc/pione-completion.erb
pione-0.5.0.alpha.2 misc/pione-completion.erb
pione-0.5.0.alpha.1 misc/pione-completion.erb
pione-0.4.2 misc/pione-completion.erb
pione-0.4.1 misc/pione-completion.erb
pione-0.4.0 misc/pione-completion.erb