module Clamp::Command::RunWithCompletion
Adds –shell-completions option and handles the Wanted exception.
Public Instance Methods
run(invocation_path = File.basename($PROGRAM_NAME), arguments = ARGV, context = {})
click to toggle source
Calls superclass method
# File lib/clamp/completion.rb, line 124 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.message}" exit(1) end end