Class: RosettAi::Completion::Shells::BashGenerator

Inherits:
Object
  • Object
show all
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.

Author:

  • hugo

  • claude

Instance Method Summary collapse

Constructor Details

#initialize(command_tree) ⇒ BashGenerator

Returns a new instance of BashGenerator.

Parameters:

  • command_tree (Hash)

    command tree from Generator



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

#generateString

Returns bash completion script.

Returns:

  • (String)

    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