#!/usr/bin/env ruby # The command line Restfully client lib_dir = File.expand_path(File.dirname(__FILE__) + '/../lib') $LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include? lib_dir require 'restfully' require 'optparse' require 'logger' require 'pp' logger = Logger.new(STDERR) logger.level = Logger::WARN @options = {"logger" => logger, "require" => []} option_parser = OptionParser.new do |opts| opts.banner = < IRB.conf[:SAVE_HISTORY] = 100 IRB.conf[:HISTORY_FILE] = "#{HOME}/.irb-save-history" module Readline module History LOG = "#{HOME}/.irb-history" def self.write_log(line) File.open(LOG, 'ab') {|f| f << "#{line}\n" } end def self.start_session_log write_log("\n") end end alias :old_readline :readline def readline(*args) ln = old_readline(*args) begin History.write_log(ln) rescue end ln end end Readline::History.start_session_log ARGV.clear ARGV.concat [ "--readline", "--prompt-mode", "simple" ] IRB.start exit!