Module: Doing::Completion
- Defined in:
- lib/doing/completion.rb
Overview
Completion script generator
Class Method Summary collapse
Class Method Details
.generate_completion(type: 'zsh', file: 'stdout') ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/doing/completion.rb', line 15 def generate_completion(type: 'zsh', file: 'stdout') generator = case type.to_s when /^f/ FishCompletions.new when /^b/ BashCompletions.new else ZshCompletions.new end result = generator.generate_completions if file =~ /^stdout$/i $stdout.puts result else File.open(File.(file), 'w') do |f| f.puts result end Doing.logger.warn('File written:', "#{type} completions written to #{file}") end end |