Class: RosettAi::Completion::Shells::BashGenerator
- Inherits:
-
Object
- Object
- RosettAi::Completion::Shells::BashGenerator
- Defined in:
- lib/rosett_ai/completion/shells/bash_generator.rb
Overview
Generates bash completion scripts from the Thor command tree.
Uses bash-completion framework conventions with _raictl() function. Dynamic completions for behaviour names and engine names use rai subcommands at tab-completion time.
Instance Method Summary collapse
-
#generate ⇒ String
Bash completion script.
-
#initialize(command_tree) ⇒ BashGenerator
constructor
A new instance of BashGenerator.
Constructor Details
#initialize(command_tree) ⇒ BashGenerator
Returns a new instance of BashGenerator.
19 20 21 |
# File 'lib/rosett_ai/completion/shells/bash_generator.rb', line 19 def initialize(command_tree) @command_tree = command_tree end |
Instance Method Details
#generate ⇒ String
Returns bash completion script.
24 25 26 27 28 29 30 31 32 |
# File 'lib/rosett_ai/completion/shells/bash_generator.rb', line 24 def generate lines = [] lines << header lines << main_function lines << subcommand_functions lines << dynamic_completions lines << registration lines.join("\n") end |