Sha256: 95141a00ca9f8976fd61a64ba9a61d6e8d490d15f4d1bd33d47fe0a845d0049b

Contents?: true

Size: 753 Bytes

Versions: 2

Compression:

Stored size: 753 Bytes

Contents

require 'optparse'

trap("INT"){exit}

OptionParser.new do |o|
  o.on("-d DIRECTORY", "--directory", "The directory to start in") {|dir| @dir = dir}
end.parse!

def dir
  @dir ||= "."
  File.absolute_path @dir
end

def os
  if (/Windows/ =~ ENV['OS']) != nil
    return :windows
  elsif (/darwin/ =~ RUBY_PLATFORM) != nil
    return :darwin
  else
    return :linux
  end
end

require 'fileutils'
require "zip"
require "hotplate/version"

puts "HotPlate CLI Version #{HotPlate::VERSION}"
puts
puts "Error: No option selected!" unless ARGV.length > 0
first_arg = ARGV.shift

begin
  (puts "recursion is a bad idea idea idea idea"; exit;) if first_arg == 'main'
  require_relative "#{first_arg}"
rescue LoadError
  puts "Invalid Option: #{first_arg}"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hotplate-1.0.3 lib/hotplate/cli/main.rb
hotplate-1.0.2 lib/hotplate/cli/main.rb