def execute
      if options[:version]
        self.console.puts "traject version #{Traject::VERSION}"
        return
      end
      if options[:help]
        self.console.puts slop.help
        return
      end


      (options[:load_path] || []).each do |path|
        $LOAD_PATH << path unless $LOAD_PATH.include? path
      end

      arg_check!

      self.indexer = initialize_indexer!

      ######
      # SAFE TO LOG to indexer.logger starting here, after indexer is set up from conf files
      # with logging config.
      #####

      indexer.logger.info("traject (#{Traject::VERSION}) executing with: `#{orig_argv.join(' ')}`")

      # Okay, actual command process! All command_ methods should return true
      # on success, or false on failure.
      result =
        case options[:command]
        when "process"
          (io, filename) = get_input_io(self.remaining_argv)
          indexer.settings['command_line.filename'] = filename if filename
          indexer.process(io)
        when "marcout"
           (io, filename) = get_input_io(self.remaining_argv)
          indexer.settings['command_line.filename'] = filename if filename
          command_marcout!(io)
        when "commit"
          command_commit!
        else
          raise ArgumentError.new("Unrecognized traject command: #{options[:command]}")
        end

      return result
    rescue Exception => e
      # Try to log unexpected exceptions if possible
      indexer && indexer.logger && indexer.logger.fatal("Traject::CommandLine: Unexpected exception, terminating execution: #{Traject::Util.exception_to_log_message(e)}") rescue nil
      raise e
    end
def execute
      if options[:version]
        self.console.puts "traject version #{Traject::VERSION}"
        return
      end
      if options[:help]
        self.console.puts slop.help
        return
      end


      (options[:load_path] || []).each do |path|
        $LOAD_PATH << path unless $LOAD_PATH.include? path
      end

      arg_check!

      self.indexer = initialize_indexer!

      ######
      # SAFE TO LOG to indexer.logger starting here, after indexer is set up from conf files
      # with logging config.
      #####

      indexer.logger.info("traject (#{Traject::VERSION}) executing with: `#{orig_argv.join(' ')}`")

      # Okay, actual command process! All command_ methods should return true
      # on success, or false on failure.
      result =
        case options[:command]
        when "process"
          (io, filename) = get_input_io(self.remaining_argv)
          indexer.settings['command_line.filename'] = filename if filename
          indexer.process(io)
        when "marcout"
           (io, filename) = get_input_io(self.remaining_argv)
          indexer.settings['command_line.filename'] = filename if filename
          command_marcout!(io)
        when "commit"
          command_commit!
        else
          raise ArgumentError.new("Unrecognized traject command: #{options[:command]}")
        end

      return result
    rescue Exception => e
      # Try to log unexpected exceptions if possible
      indexer && indexer.logger && indexer.logger.fatal("Traject::CommandLine: Unexpected exception, terminating execution: #{Traject::Util.exception_to_log_message(e)}") rescue nil
      raise e
    end
Returns true on success or false on failure; may also raise exceptions;
 may also exit program directly itself (yeah, could use some normalization)