module Af::OptionParser::Interface
Public Instance Methods
opt(long_name, *extra_stuff, &b)
click to toggle source
Update Options for the provided long switch option name. Just a helper to UI method “opt”
# File lib/fiksu-af/option_parser/interface.rb, line 15 def opt(long_name, *extra_stuff, &b) self.class.opt(long_name, *extra_stuff, &b) end
opt_check(var_name, *extra_stuff, &b)
click to toggle source
Update OptionChecks for the provided group option name. Just a helper to UI method “opt_check”
# File lib/fiksu-af/option_parser/interface.rb, line 27 def opt_check(var_name, *extra_stuff, &b) self.class.opt_check(var_name, *extra_stuff, &b) end
opt_error(text)
click to toggle source
used by application code to note an error and exit
# File lib/fiksu-af/option_parser/interface.rb, line 4 def opt_error(text) self.class.opt_error(text) end
opt_group(group_name, *extra_stuff, &b)
click to toggle source
Update OptionGroups for the provided group option name. Just a helper to UI method “opt_group”
# File lib/fiksu-af/option_parser/interface.rb, line 21 def opt_group(group_name, *extra_stuff, &b) self.class.opt_group(group_name, *extra_stuff, &b) end
opt_select(var_name, *extra_stuff, &b)
click to toggle source
Update OptionSelects for the provided group option name. Just a helper to UI method “opt_select”
# File lib/fiksu-af/option_parser/interface.rb, line 33 def opt_select(var_name, *extra_stuff, &b) self.class.opt_select(var_name, *extra_stuff, &b) end
process_command_line_options(af_option_interests)
click to toggle source
Collect and process all of the switches (values) on the command line, as previously configured.
# File lib/fiksu-af/option_parser/interface.rb, line 39 def process_command_line_options(af_option_interests) # Iterate through all options in the class heirachy. # Create instance variables and accessor methods for each. option_finder = OptionFinder.new(af_option_interests) options = option_finder.all_options options.each(&:instantiate_target_variable) # Fetch the actual switches (and values) from the command line. get_options = GetOptions.new(options) # Iterate through the command line options. Print and exit if the switch # is invalid, help or app version. Otherwise, process and handle. begin get_options.each do |long_name, argument| option_finder.find_option(long_name).evaluate_and_set_target(argument) end rescue GetoptLong::Error, Error => e opt_error e.message end end
usage()
click to toggle source
Returns a string detailing application usage.
# File lib/fiksu-af/option_parser/interface.rb, line 9 def usage return self.class.usage end