lib/mireru/command/mireru.rb in mireru-0.1.0 vs lib/mireru/command/mireru.rb in mireru-0.1.1

- old
+ new

@@ -1,9 +1,10 @@ require 'gtk3' require "mireru/logger" require "mireru/window" require "mireru/container" +require "mireru/version" module Mireru module Command class Mireru USAGE = "Usage: mireru [OPTION]... [FILE]..." @@ -20,10 +21,13 @@ def run(arguments) if /\A(-h|--help)\z/ =~ arguments[0] write_help_message exit(true) + elsif /\A(-v|--version)\z/ =~ arguments[0] + write_version_message + exit(true) end files = files_from_arguments(arguments) file_container = ::Mireru::Container.new(files) @@ -93,14 +97,23 @@ o: original size EOM @logger.info(message) end + def write_version_message + message = <<-EOM +#{::Mireru::VERSION} + EOM + @logger.info(message) + end + def write_empty_message message = <<-EOM Warning: file not found. #{USAGE} If no argument, then search current directory. +Options: + -d, --deep: deep search EOM @logger.error(message) end end end