Skip to content

Commit

Permalink
removed commented old options
Browse files Browse the repository at this point in the history
  • Loading branch information
urbanadventurer committed Jan 5, 2013
1 parent 33d6e34 commit c46df8c
Showing 1 changed file with 0 additions and 131 deletions.
131 changes: 0 additions & 131 deletions username-anarchy
Expand Up @@ -531,138 +531,7 @@ rescue OptionParser::InvalidOption, OptionParser::MissingArgument #
exit
end

#p $options
#p ARGV

# GetoptLong
# --------------------------------------
=begin
opts = GetoptLong.new(
[ '--help', '-h', GetoptLong::NO_ARGUMENT ],
[ '--auto', '-a', GetoptLong::NO_ARGUMENT ],
[ '--input-file', '-i', GetoptLong::REQUIRED_ARGUMENT ],
[ '--list-formats', '-l', GetoptLong::NO_ARGUMENT ],
[ '--select-format', '-f', GetoptLong::REQUIRED_ARGUMENT ],
[ '--recognise', '-r', GetoptLong::REQUIRED_ARGUMENT ],
[ '--substitute', '-s', GetoptLong::REQUIRED_ARGUMENT ],
[ '--max-substitutions','-m', GetoptLong::REQUIRED_ARGUMENT ],
[ '--given-names', GetoptLong::REQUIRED_ARGUMENT ],
[ '--family-names', GetoptLong::REQUIRED_ARGUMENT ],
[ '--country','-c', GetoptLong::REQUIRED_ARGUMENT ],
[ '--format','-F', GetoptLong::REQUIRED_ARGUMENT ],
[ '--verbose','-v', GetoptLong::NO_ARGUMENT ]
)
begin
opts.each do |opt, arg|
case opt
when '-i', '--input-file'
$options[:input_file] = arg
when '-a', '--auto'
$options[:no_input_names] = true
when '-l', '--list-formats'
$options[:substitute] = true
list_plugins
exit
when '-f', '--select-format'
$options[:selected_plugins] = arg.split(",")
$options[:selected_plugins].each { |x|
error("Format plugin not found: #{x}.") unless Plugin.registered_plugins.map { |p| p.plugin_name }.include?(x) }
when '-F', '--format'
$options[:selected_plugins] = "custom"
fmt = arg.delete('"')
code = "
Plugin.define \"custom\" do
def generate(n)
n.format_anna(\"#{fmt}\")
end
end"
eval(code)
when '-m', '--max-substitutions'
if arg.to_i > 0
$options[:max_substitutions] = arg.to_i-1
else
raise("maximum substitutions must be a positive integer")
end
when '--given-names'
if File.readable?($options[:given_names])
$options[:given_names] = arg
else
raise "Cannot read file: #{arg}"
end
when '--family-names'
if File.readable?($options[:family_names])
$options[:family_names] = arg
else
raise "Cannot read file: #{arg}"
end
when '--country', '-c'
dataset = arg.downcase
if dataset == "facebook"
dataset_file="#{$ROOT_DIR}/names/facebook/firstnames-top10000.txt"
if File.readable?(dataset_file)
$options[:given_names] = dataset_file
else
raise "Cannot read file: #{dataset_file}"
exit
end
dataset_file = "#{$ROOT_DIR}/names/facebook/lastnames-top10000.txt"
if File.readable?(dataset_file)
$options[:given_names] = dataset_file
else
raise "Cannot read file: #{dataset_file}"
exit
end
else
dataset_file = "#{$ROOT_DIR}names/publicprofiler/#{arg}-forenames.txt"
if File.readable?(dataset_file)
$options[:given_names] = dataset_file
else
raise "Cannot read file: #{dataset_file}"
exit
end
dataset_file = "#{$ROOT_DIR}names/publicprofiler/#{arg}-surnames.txt"
if File.readable?(dataset_file)
$options[:given_names] = dataset_file
else
raise "Cannot read file: #{dataset_file}"
exit
end
end
when '-s', '--substitute'
if arg == "on"
$options[:substitute] = true
elsif arg == "off"
$options[:substitute] = false
else
raise("invalid argument for --substitute")
end
when '-v', '--verbose'
$options[:verbose] = true
when '-r', '--recognise'
$options[:format_to_recognise] = arg
$options[:no_input_names] = true
puts "Recognising #{arg}. This can take a while."
format = recognise_username_format($options[:format_to_recognise])
if format
puts "Username format #{$options[:format_to_recognise]} recognised. Plugin name: #{format}"
else
puts "Username format #{$options[:format_to_recognise]} unrecognised."
end
exit
when '-h', '--help'
usage
exit
end
end
rescue GetoptLong::Error => err
puts
usage
exit
end

=end

people = [] # init the array of people

Expand Down

0 comments on commit c46df8c

Please sign in to comment.