class Testimonium::CLI::CLI

The CLI is a class, entry point for CLI commands

Public Class Methods

new(arguments) click to toggle source
# File lib/testimonium/cli.rb, line 16
def initialize(arguments)
  @arguments = arguments.dup
end

Public Instance Methods

evaluate() click to toggle source
# File lib/testimonium/cli.rb, line 20
def evaluate
  parse_arguments!
end
parse_arguments!() click to toggle source
# File lib/testimonium/cli.rb, line 24
def parse_arguments!
  argument = @arguments.shift

  begin
    case argument
    when 'create'
      parse_create_arguments!
    when 'run'
      parse_run_arguments!
    when 'version'
      puts Testimonium::VERSION
    when 'help'
      print_usage
    when nil
      print_usage
    else
      raise("Invalid command #{argument}.\nFor help use 'testimonium help'")
    end
  rescue StandardError => e
    puts e.message.to_s
    exit 1
  end
end