Class: Completion::Command::Install

Inherits:
Samovar::Command
  • Object
show all
Defined in:
lib/completion/command/install.rb

Overview

Install a shell completion adapter script to a user-local completion directory.

Instance Method Summary collapse

Instance Method Details

#callObject

Install the generated shell adapter script.



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/completion/command/install.rb', line 29

def call
	shell = @options[:shell]
	directory = @options[:directory] || Shell.default_directory(shell)
	path = File.join(directory, Shell.file_name(shell, @options[:command]))
	script = Shell.script(shell: shell, executable: @options[:command])
	
	FileUtils.mkdir_p(directory)
	shared_paths = install_shared(shell, directory)
	File.write(path, script)
	
	output.puts(shared_paths)
	output.puts path
end