Class: Clamp::Completion::BashGenerator
- Inherits:
-
Object
- Object
- Clamp::Completion::BashGenerator
- Defined in:
- lib/clamp/completion/bash_generator.rb
Overview
Generates bash shell completion scripts.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(command_class, executable_name) ⇒ BashGenerator
constructor
A new instance of BashGenerator.
Constructor Details
#initialize(command_class, executable_name) ⇒ BashGenerator
Returns a new instance of BashGenerator.
10 11 12 13 |
# File 'lib/clamp/completion/bash_generator.rb', line 10 def initialize(command_class, executable_name) @command_class = command_class @executable_name = executable_name end |
Instance Method Details
#generate ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/clamp/completion/bash_generator.rb', line 15 def generate [ "# Bash completions for #{@executable_name}", "# Generated by Clamp", "", takes_value_function, "", completion_function, "", "complete -F _#{function_name} #{@executable_name}" ].push("").join("\n") end |