class MarkdownExec::MarkParse

def lambda_for_procname(procname, options)

Returns:
  • (Lambda) - The corresponding lambda expression.

Parameters:
  • options (Hash) -- The options hash, necessary for some lambdas to access.
  • procname (String) -- The name of the process to generate a lambda for.
def lambda_for_procname(procname, options)
  case procname
  when 'debug'
    ->(value) { tap_config value: value }
  when 'exit'
    ->(_) { exit }
  when 'find', 'open'
    ->(value) {
      exit if find_value(value, execute_chosen_found: procname == 'open').fetch(:exit, false)
    }
  when 'help'
    ->(_) {
      @fout.fout menu_help
      exit
    }
  when 'how'
    ->(value) {
      @fout.fout(list_default_yaml.select { |line| line.include? value })
      exit
    }
  when 'path'
    ->(value) {
      read_configuration_file!(options, value)
    }
  when 'show_config'
    ->(_) {
      finalize_cli_argument_processing(options)
      @fout.fout options.sort_by_key.to_yaml
    }
  when 'val_as_bool'
    ->(value) {
      value.instance_of?(::String) ? (value.chomp != '0') : value
    }
  when 'val_as_int'
    ->(value) { value.to_i }
  when 'val_as_str'
    ->(value) { value.to_s }
  when 'version'
    lambda { |_|
      @fout.fout MarkdownExec::VERSION
      exit
    }
  else
    procname
  end
end