git-svn-id: https://beef.googlecode.com/svn/trunk@503 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
37 lines
745 B
Ruby
37 lines
745 B
Ruby
module BeEF
|
|
module Console
|
|
|
|
module CommandLine
|
|
|
|
@options = Hash.new
|
|
@options[:verbose] = false
|
|
@options[:resetdb] = false
|
|
|
|
@already_parsed = false
|
|
|
|
#
|
|
# Parses the command line arguments of the console.
|
|
# It also populates the 'options' hash.
|
|
#
|
|
def self.parse
|
|
return @options if @already_parsed
|
|
|
|
optparse = OptionParser.new do |opts|
|
|
opts.on('-x', '--reset', 'Reset the database') do
|
|
@options[:resetdb] = true
|
|
end
|
|
|
|
opts.on('-v', '--verbose', 'Display debug information') do
|
|
@options[:verbose] = true
|
|
end
|
|
end
|
|
|
|
optparse.parse!
|
|
@already_parsed = true
|
|
@options
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
end |