Module: Clamp::Command::RunWithCompletion
- Included in:
- Clamp::Command
- Defined in:
- lib/clamp/completion.rb
Overview
Adds –shell-completions option and handles the Wanted exception.
Instance Method Summary collapse
Instance Method Details
#run(invocation_path = File.basename($PROGRAM_NAME), arguments = ARGV, context = {}) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/clamp/completion.rb', line 100 def run(invocation_path = File.basename($PROGRAM_NAME), arguments = ARGV, context = {}) context[:root_command_class] ||= self super rescue Clamp::Completion::Wanted => e shell_name = File.basename(e.shell).to_sym begin puts generate_completion(shell_name, invocation_path) rescue ArgumentError => ex $stderr.puts "ERROR: #{ex.}" exit(1) end end |