Class: Mireru::Command::Mireru

Inherits:
Object
  • Object
show all
Defined in:
lib/mireru/command/mireru.rb

Constant Summary collapse

USAGE =
"Usage: mireru [OPTION]... [FILE_OR_DIRECTORY]..."

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMireru

Returns a new instance of Mireru.



32
33
34
# File 'lib/mireru/command/mireru.rb', line 32

def initialize
  @logger = ::Mireru::Logger.new
end

Class Method Details

.run(*arguments) ⇒ Object



27
28
29
# File 'lib/mireru/command/mireru.rb', line 27

def run(*arguments)
  new.run(arguments)
end

Instance Method Details

#run(arguments) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/mireru/command/mireru.rb', line 36

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

  font = purge_option(arguments, /\A(-f|--font)\z/, true)

  files = files_from_arguments(arguments)

  window = ::Mireru::Window.new(files)
  window.font = font if font

  window.run
end