lib/aws_recon/options.rb in aws_recon-0.2.27 vs lib/aws_recon/options.rb in aws_recon-0.2.28
- old
+ new
@@ -1,7 +1,10 @@
# frozen_string_literal: true
+#
+# Command line options parser
+#
class Parser
DEFAULT_CONFIG_FILE = nil
DEFAULT_OUTPUT_FILE = File.expand_path(File.join(Dir.pwd, 'output.json')).freeze
SERVICES_CONFIG_FILE = File.join(File.dirname(__FILE__), 'services.yaml').freeze
DEFAULT_FORMAT = 'aws'
@@ -95,19 +98,15 @@
args.output_file = File.expand_path(File.join(Dir.pwd, output))
end
# output format
opts.on('-f', '--format [FORMAT]', 'Specify output format (default: aws)') do |file|
- if %w[aws custom].include?(file.downcase)
- args.output_format = file.downcase
- end
+ args.output_format = file.downcase if %w[aws custom].include?(file.downcase)
end
# threads
opts.on('-t', '--threads [THREADS]', "Specify max threads (default: #{Parser::DEFAULT_THREADS}, max: 128)") do |threads|
- if (0..Parser::MAX_THREADS).include?(threads.to_i)
- args.threads = threads.to_i
- end
+ args.threads = threads.to_i if (0..Parser::MAX_THREADS).include?(threads.to_i)
end
# collect EC2 instance user data
opts.on('-u', '--user-data', 'Collect EC2 instance user data (default: false)') do
args.collect_user_data = true