lib/headdesk/cli.rb in headdesk-0.5.2 vs lib/headdesk/cli.rb in headdesk-0.6.0

- old
+ new

@@ -10,11 +10,11 @@ # headdesk CLI # # :reek:TooManyStatements class CLI < Thor desc 'unpack FILE [DESTINATION]', 'Unpack an APK or IPA to [DESTINATION] or to the current directory' - method_option :analize, type: :boolean, aliases: '-a' + method_option :analyze, type: :boolean, aliases: '-a' def unpack(file, destination = nil) # Make sure the input file exists unless File.exist?(file) STDERR.puts "Could not find: #{file}" CLI.command_help(Thor::Base.shell.new, 'unpack') @@ -41,12 +41,12 @@ end else stdout = Headdesk::ApkTool.unpack_to(file, destination) end - # Analize if requested - Headdesk::Analize.at(output_path) if options[:analize] + # analyze if requested + Headdesk::Analyze.at(output_path) if options[:analyze] rescue CliError => cli_err STDERR.puts cli_err.message CLI.command_help(Thor::Base.shell.new, 'unpack') return 1 rescue StandardError => rb_err @@ -54,18 +54,18 @@ STDERR.puts err.backtrace.ai return 1 end end - desc 'analize [FILE]', 'Analize an APK or IPA' + desc 'analyze [FILE]', 'Analyze an APK or IPA' method_option :path, type: :string method_option :json, type: :boolean - def analize(file = nil) + def analyze(file = nil) # Make sure input file exsts, if specified unless !file || File.exist?(file) STDERR.puts "Could not find input file: #{file}" - CLI.command_help(Thor::Base.shell.new, 'analize') + CLI.command_help(Thor::Base.shell.new, 'analyze') return 1 end # Unpack APK if needed path = options[:path] @@ -76,25 +76,25 @@ end # Make sure path exists unless Dir.exist?(path) STDERR.puts "Could not find path: #{path}" - CLI.command_help(Thor::Base.shell.new, 'analize') + CLI.command_help(Thor::Base.shell.new, 'analyze') return 1 end - # Analize + # analyze begin - report = Headdesk::Analize.at(path) + report = Headdesk::Analyze.at(path) if options[:json] STDOUT.puts report.to_json else STDOUT.puts report.to_s end rescue CliError => cli_err STDERR.puts cli_err.message - CLI.command_help(Thor::Base.shell.new, 'analize') + CLI.command_help(Thor::Base.shell.new, 'analyze') return 1 rescue StandardError => err STDERR.puts err.message.red STDERR.puts err.backtrace.ai return 1