Class: Autoproj::ZshCompletion

Inherits:
ShellCompletion show all
Defined in:
lib/autoproj/zsh_completion.rb

Overview

This class generates shell completion for code for a given Thor subclasss

Constant Summary collapse

MAIN_FUNCTION_TEMPLATE =
"main.zsh.erb"
SUBCOMMAND_FUNCTION_TEMPLATE =
"subcommand.zsh.erb"

Constants inherited from ShellCompletion

ShellCompletion::TEMPLATES_DIR

Instance Attribute Summary

Attributes inherited from ShellCompletion

#cli, #cli_metadata, #name

Instance Method Summary collapse

Methods inherited from ShellCompletion

#generate, #generate_command_metadata, #generate_metadata, #hyphenate, #initialize, #options_metadata, #populate_help_subcommands, #render_subcommand_function, #setup_completion_functions, #subcommand_by_name, #subcommand_metadata

Constructor Details

This class inherits a constructor from Autoproj::ShellCompletion

Instance Method Details

#bracket(s) ⇒ Object



30
31
32
# File 'lib/autoproj/zsh_completion.rb', line 30

def bracket(s)
    %([#{s}])
end

#disable_completion(metadata) ⇒ Object



21
22
23
# File 'lib/autoproj/zsh_completion.rb', line 21

def disable_completion()
    [:completer] = ":"
end

#escape_option_names(names) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/autoproj/zsh_completion.rb', line 34

def escape_option_names(names)
    if names.size == 1
        names.first
    else
        "{#{names.join(',')}}"
    end
end

#quote(s) ⇒ Object



25
26
27
28
# File 'lib/autoproj/zsh_completion.rb', line 25

def quote(s)
    escaped = s.gsub(/'/, "''")
    %('#{escaped}')
end

#setup_executable_completion(metadata) ⇒ Object



13
14
15
# File 'lib/autoproj/zsh_completion.rb', line 13

def setup_executable_completion()
    [:completer] = "_path_commands"
end

#setup_file_completion(metadata) ⇒ Object



9
10
11
# File 'lib/autoproj/zsh_completion.rb', line 9

def setup_file_completion()
    [:completer] = "_files"
end

#setup_package_completion(metadata) ⇒ Object



17
18
19
# File 'lib/autoproj/zsh_completion.rb', line 17

def setup_package_completion()
    [:completer] = "_autoproj_installed_packages"
end