Class: RosettAi::Completion::Shells::FishGenerator

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

Overview

Generates fish completion scripts from the Thor command tree.

Uses fish's complete builtin with condition-based subcommand completion. Supports subcommand descriptions and dynamic completions for behaviour/engine names.

Author:

  • hugo

  • claude

Instance Method Summary collapse

Constructor Details

#initialize(command_tree) ⇒ FishGenerator

Returns a new instance of FishGenerator.

Parameters:

  • command_tree (Hash)

    command tree from Generator



19
20
21
# File 'lib/rosett_ai/completion/shells/fish_generator.rb', line 19

def initialize(command_tree)
  @command_tree = command_tree
end

Instance Method Details

#generateString

Returns fish completion script.

Returns:

  • (String)

    fish completion script



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

def generate
  lines = []
  lines << header
  lines << disable_file_completion
  lines << top_level_completions
  lines << subcommand_completions
  lines.join("\n")
end