Class: RosettAi::Thor::Tasks::Completion
- Inherits:
-
Thor
- Object
- Thor
- RosettAi::Thor::Tasks::Completion
- 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.
Constant Summary collapse
- INSTALL_PATHS =
Returns 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
-
#bash ⇒ void
Generate bash shell completion script.
-
#fish ⇒ void
Generate fish shell completion script.
-
#install ⇒ void
Install the component.
-
#zsh ⇒ void
Generate zsh shell completion script.
Instance Method Details
#bash ⇒ void
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 |
#fish ⇒ void
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 |
#install ⇒ void
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 |
#zsh ⇒ void
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 |