Class: RosettAi::Thor::Tasks::Completion

Inherits:
Thor
  • Object
show all
Defined in:
lib/rosett_ai/thor/tasks/completion.rb

Overview

Thor subcommand for generating shell completion scripts.

Generates bash, zsh, and fish completion scripts from the Thor command registry. Scripts are output to stdout for piping or can be installed to the standard completion directory.

Author:

  • hugo

  • claude

Constant Summary collapse

INSTALL_PATHS =

Returns Shell-specific completion installation paths.

Returns:

  • (Hash)

    Shell-specific completion installation paths.

{
  'bash' => '/usr/share/bash-completion/completions/rai',
  'zsh' => '/usr/share/zsh/vendor-completions/_rai',
  'fish' => "#{Dir.home}/.config/fish/completions/raictl.fish"
}.freeze

Instance Method Summary collapse

Instance Method Details

#bashvoid

This method returns an undefined value.

Generate bash shell completion script.



35
36
37
# File 'lib/rosett_ai/thor/tasks/completion.rb', line 35

def bash
  output_completion('bash')
end

#fishvoid

This method returns an undefined value.

Generate fish shell completion script.



63
64
65
# File 'lib/rosett_ai/thor/tasks/completion.rb', line 63

def fish
  output_completion('fish')
end

#installvoid

This method returns an undefined value.

Install the component.



90
91
92
93
94
95
96
97
# File 'lib/rosett_ai/thor/tasks/completion.rb', line 90

def install
  shell = detect_shell
  generator = RosettAi::Completion::Generator.new
  script = generator.generate(shell)
  path = INSTALL_PATHS.fetch(shell)

  install_script(script, path, shell)
end

#zshvoid

This method returns an undefined value.

Generate zsh shell completion script.



49
50
51
# File 'lib/rosett_ai/thor/tasks/completion.rb', line 49

def zsh
  output_completion('zsh')
end