lib/mireru/command/mireru.rb in mireru-0.0.4 vs lib/mireru/command/mireru.rb in mireru-0.0.5

- old
+ new

@@ -15,10 +15,20 @@ end def run(arguments) if arguments.empty? file_container = Dir.glob("*") + elsif /\A(-h|--help)\z/ =~ arguments[0] + puts(USAGE) + puts <<-EOS + If no argument, then search current directory. +Keybind: + n: next + p: prev + q: quit + EOS + exit(true) else file_container = arguments end file_container.select! {|f| support_file?(f) } @@ -32,18 +42,23 @@ image = Gtk::Image.new image.file = file_container.shift window = Gtk::Window.new + window.title = File.basename(image.file) window.signal_connect("key_press_event") do |w, e| case e.keyval when Gdk::Keyval::GDK_KEY_n file_container.push(image.file) image.file = file_container.shift + window.title = File.basename(image.file) + window.resize(1, 1) when Gdk::Keyval::GDK_KEY_p file_container.unshift(image.file) image.file = file_container.pop + window.title = File.basename(image.file) + window.resize(1, 1) when Gdk::Keyval::GDK_KEY_q Gtk.main_quit end end