class Raheui::CLI

Handle command line interfaces logic.

Public Class Methods

new() click to toggle source

Initialize a CLI.

# File lib/raheui/cli.rb, line 7
def initialize
  @options = {}
end

Public Instance Methods

run(args = ARGV) click to toggle source

Entry point for the applicaiton logic. Process command line arguments and run the Aheui code.

args - An Array of Strings user passed.

Returns an Integer UNIX exit code.

# File lib/raheui/cli.rb, line 17
def run(args = ARGV)
  @options, paths = Option.new.parse(args)
  source = if paths.empty?
             $stdin.read
           else
             File.read(paths[0])
           end
  runner = Runner.new(Code.new(source))
  runner.run
end