Sha256: 903625ff9d253e132d976093110f5f06e8a51b8b00094f9bb1278d71e9fc076f
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
# frozen_string_literal: true require 'thor' module Hackasm # Handle the application command line parsing # and the dispatch to various command objects # # @api public class CLI < Thor # Error raised by this runner Error = Class.new(StandardError) desc 'version', 'hackasm version' def version require_relative 'version' puts "v#{Hackasm::VERSION}" end map %w(--version -v) => :version desc 'vm2asm FILE', 'Translate *.vm file with virtual machine code or a folder of *.vm files to the single *.asm file of assembler commands' method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information' def vm2asm(base_path) if options[:help] invoke :help, ['vm2asm'] else require_relative 'commands/vm2asm' Hackasm::Commands::Vm2Asm.new(base_path, options).execute end end desc 'asm2binary FILE', 'Translate *.asm file of assembler commands to *.hack file of binary commands' method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information' def asm2binary(file) if options[:help] invoke :help, ['asm2binary'] else require_relative 'commands/asm2binary' Hackasm::Commands::Asm2Binary.new(file, options).execute end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hackasm-0.1.0 | lib/hackasm/cli.rb |