bin/hvm in haxor-0.1.0 vs bin/hvm in haxor-0.2.0
- old
+ new
@@ -1,11 +1,30 @@
#! /usr/bin/env ruby
require_relative '../lib/haxor'
+require 'optparse'
+
+parser = OptionParser.new do |opts|
+ opts.banner = 'Usage: hvm [options] [file.hax.e]'
+
+ opts.on_tail('-h', '--help', 'Show this message') do
+ puts opts
+ exit
+ end
+
+ opts.on_tail('-v', '--version', 'Show version') do
+ puts "Haxor, version #{Haxor::Consts::GEM_VERSION}, version id #{Haxor::Consts::VERSION}."
+ exit
+ end
+end
+
+parser.parse!
+
if ARGV[0].nil?
- puts "You must specify .hax.e file to be run."
- exit 1
+ puts 'You must specify .hax.e file to be run.'
+ puts parser
+ exit
end
vm = Haxor::Vm::Core.new
filename = ARGV[0]