Class: Autoproj::ZshCompletion
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"
ShellCompletion::TEMPLATES_DIR
Instance Attribute Summary
#cli, #cli_metadata, #name
Instance Method Summary
collapse
#generate, #generate_command_metadata, #generate_metadata, #hyphenate, #initialize, #options_metadata, #populate_help_subcommands, #render_subcommand_function, #setup_completion_functions, #subcommand_by_name, #subcommand_metadata
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(metadata)
metadata[: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(metadata)
metadata[:completer] = "_path_commands"
end
|
#setup_file_completion(metadata) ⇒ Object
9
10
11
|
# File 'lib/autoproj/zsh_completion.rb', line 9
def setup_file_completion(metadata)
metadata[:completer] = "_files"
end
|
#setup_package_completion(metadata) ⇒ Object
17
18
19
|
# File 'lib/autoproj/zsh_completion.rb', line 17
def setup_package_completion(metadata)
metadata[:completer] = "_autoproj_installed_packages"
end
|