Class: Herve::CLI::ShellCommands::Completion

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/herve/cli/shell_commands/completion.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#config, #logger

Instance Method Summary collapse

Methods inherited from BaseCommand

inherited

Instance Method Details

#call(shell:, **_args) ⇒ Object

Raises:



12
13
14
15
16
17
18
19
20
21
# File 'lib/herve/cli/shell_commands/completion.rb', line 12

def call(shell:, **_args)
  raise Error, "unsupported shell '#{shell}'" unless SUPPORTED_SHELLS.include?(shell)

  if shell == "zsh"
    puts "autoload -Uz +X compinit && compinit"
    puts "autoload -Uz +X bashcompinit && bashcompinit"
  end

  puts Completely::Completions.new(generate_completion_data).script
end