Class: RosettAi::Completion::Shells::ZshGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/completion/shells/zsh_generator.rb

Overview

Generates zsh completion scripts from the Thor command tree.

Uses zsh compdef system with _raictl function and _arguments helper. Supports subcommand descriptions shown during tab completion.

Author:

  • hugo

  • claude

Instance Method Summary collapse

Constructor Details

#initialize(command_tree) ⇒ ZshGenerator

Returns a new instance of ZshGenerator.

Parameters:

  • command_tree (Hash)

    command tree from Generator



18
19
20
# File 'lib/rosett_ai/completion/shells/zsh_generator.rb', line 18

def initialize(command_tree)
  @command_tree = command_tree
end

Instance Method Details

#generateString

Returns zsh completion script.

Returns:

  • (String)

    zsh completion script



23
24
25
26
27
28
29
30
# File 'lib/rosett_ai/completion/shells/zsh_generator.rb', line 23

def generate
  lines = []
  lines << header
  lines << main_function
  lines << subcommand_functions
  lines << registration
  lines.join("\n")
end