Module: Fylla::Thor::CompletionGenerator::ClassMethods
- Defined in:
- lib/fylla/completion_generator.rb
Overview
Contains the methods zsh_completion
Instance Method Summary collapse
-
#bash_completion(executable_name) ⇒ Object
Generates a bash _ completion script for the entire Thor application.
-
#zsh_completion(executable_name) ⇒ Object
Generates a zsh _ completion script for the entire Thor application.
Instance Method Details
#bash_completion(executable_name) ⇒ Object
Generates a bash _ completion script for the entire Thor application
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fylla/completion_generator.rb', line 42 def bash_completion(executable_name) @executable_name = executable_name command = create_command_map all_commands, subcommand_classes builder = map_to_completion_string [command], style: :bash completion = "" completion += builder completion += "complete -F _#{executable_name} #{executable_name}\n" completion end |
#zsh_completion(executable_name) ⇒ Object
Generates a zsh _ completion script for the entire Thor application
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/fylla/completion_generator.rb', line 25 def zsh_completion(executable_name) @executable_name = executable_name command = create_command_map all_commands, subcommand_classes builder = map_to_completion_string [command] completion = "#compdef _#{executable_name} #{executable_name}\n" completion += builder completion += %(_#{executable_name} "$@") completion end |