bin/room in room-0.1.3 vs bin/room in room-0.2.0

- old
+ new

@@ -28,35 +28,49 @@ opts.on("-h", "--help") { usage } opts.parse! ARGV if ARGV.length > 0 if ARGV[0] == "for" && !ARGV[1].nil? + @room = ARGV[1] @filename = find_room ARGV[1] unless @filename puts "room \"#{ARGV[1]}\" not found" exit 1 end else usage end else + @room = "beginners" @filename = find_room "beginners" end -reload! @filename +reload! @room, @filename +if Array === $state[:history] + $state[:history].each { |h| Readline::HISTORY.push h } +else + $state[:history] = [] +end + 3.times { Printer.puts } +trap("INT", "SIG_IGN") + Room.do "look" loop do line = if $secretive $secretive = false HighLine.new.ask("> ") { |q| q.echo = false } else - Readline.readline("> ", true) + x = Readline.readline("> ", true) + $state[:history] << x if x + x end break unless line Room.do line.chomp + + save! end Printer.puts "\nThe world is your cantaloupe."