Method: CodeRunner::Run::FortranNamelist.help_input

Defined in:
lib/coderunner/fortran_namelist.rb

.help_input(var = ARGV[2].to_sym) ⇒ Object

Print help for the given variable to STDOUT.



671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/coderunner/fortran_namelist.rb', line 671

def self.help_input(var=ARGV[2].to_sym)
  eputs "\n------------ Help for '#{var}' -----------------"
  eputs "\n#{(rcp.variables_with_help[var] or "No help currently available")}\n"
  varhash = find_variable_hash(var)
  namelists = rcp.namelists.find_all{|namelist, hash| hash[:variables].keys.include? var.to_sym}.map{|n,h| n}
  eputs "\nFound in namelists: #{namelists.inspect}"
  return unless varhash
  eputs "This variable must take one of the following values: \n\t#{(varhash[:allowed_values] or varhash[:text_options])}" if (varhash[:allowed_values] or varhash[:text_options])
  eputs "\n-------- Autoscanned Defaults for '#{var}' --------------\n\nIf this variable is not specified it may be given one of these default values:\n\t#{rcp.variables_with_autoscanned_defaults[var].inspect.sub(/^\[/, '').sub(/\]$/, '')}\n in the code. These values have been automatically scanned from the source code and do not constitute a recommendation; they may raise an error."
  eputs "\n-------- Must Pass Tests for '#{var}' --------------\n\nThe variable must pass the following tests:\n\n"
  varhash[:must_pass].each do |hash|
    eputs "\tTest: #{hash[:test]}" 
    eputs "\tExplanation: #{hash[:explanation]}"
  end
  eputs
end