Skip to content

Commit

Permalink
Add CLI interface implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
coderobe committed Dec 24, 2017
1 parent 01884df commit 1edb6af
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/cli.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require "thor"
require "fileutils"
require "logger"
require "colorize"
require "./src/methods"
require "./src/utils"

#Cocaine::CommandLine.logger = Logger.new(STDOUT)

module VBiosFinder
@@wd
class CLI < Thor
desc 'extract <bios update file>'.colorize(:blue), 'attempts to extract an embedded vbios from a bios update'
def extract file=nil, wd="#{Dir.pwd}/tmp-vbiosfinder"
if file.nil?
puts "no file specified".colorize(:red)
return
end
FileUtils.mkdir_p wd
@@wd = wd
Dir.chdir wd
puts "output will be stored in '#{wd}'".colorize(":blue")
Utils::installed?("ruby") # "bugfix"
Utils::get_new_files # "bugfix" #2
FileUtils.cp(file, wd)
puts
Main::run Utils::get_new_files.first
end
end
end

0 comments on commit 1edb6af

Please sign in to comment.