From f5f30468ad0d6094eb198d1c08cf4590eb1f0dff Mon Sep 17 00:00:00 2001 From: "JesusFreke@JesusFreke.com" Date: Tue, 11 Aug 2009 08:12:23 +0000 Subject: [PATCH] refactored the options a bit git-svn-id: https://smali.googlecode.com/svn/trunk@394 55b6fa8a-2a1e-11de-a435-ffa8d773f76a --- .../src/main/java/org/jf/baksmali/main.java | 36 +++++-------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/baksmali/src/main/java/org/jf/baksmali/main.java b/baksmali/src/main/java/org/jf/baksmali/main.java index 979d4075..d863ac66 100644 --- a/baksmali/src/main/java/org/jf/baksmali/main.java +++ b/baksmali/src/main/java/org/jf/baksmali/main.java @@ -73,7 +73,6 @@ public class main { boolean write = false; boolean sort = false; boolean fixRegisters = false; - boolean readOnly = false; boolean noParameterRegisters = false; String outputDirectory = "out"; @@ -100,8 +99,8 @@ public class main { inputDexFileName = remainingArgs[0]; - if (commandLine.hasOption("r")) { - readOnly = true; + if (commandLine.hasOption("n")) { + disassemble = false; } if (commandLine.hasOption("d")) { @@ -109,12 +108,6 @@ public class main { dumpFileName = commandLine.getOptionValue("d", inputDexFileName + ".dump"); } - if (commandLine.hasOption("D")) { - doDump = true; - disassemble = false; - dumpFileName = commandLine.getOptionValue("D", inputDexFileName + ".dump"); - } - if (commandLine.hasOption("w")) { write = true; outputDexFileName = commandLine.getOptionValue("w"); @@ -146,10 +139,6 @@ public class main { //Read in and parse the dex file DexFile dexFile = new DexFile(dexFileFile, !fixRegisters); - if (readOnly) { - return; - } - if (disassemble) { baksmali.disassembleDexFile(dexFile, outputDirectory, noParameterRegisters); } @@ -202,22 +191,17 @@ public class main { .withDescription("prints the help message then exits") .create("?"); - Option readonlyOption = OptionBuilder.withLongOpt("read-only") - .withDescription("reads in the dex file and then exits") - .create("r"); + Option noDisassemblyOption = OptionBuilder.withLongOpt("no-disassembly") + .withDescription("suppresses the output of the disassembly") + .create("n"); Option dumpOption = OptionBuilder.withLongOpt("dump-to") - .withDescription("dumps the given dex file into a single annotated dump file named FILE (.dump by default), along with the normal disassembly.") + .withDescription("dumps the given dex file into a single annotated dump file named FILE" + + " (.dump by default), along with the normal disassembly.") .hasOptionalArg() .withArgName("FILE") .create("d"); - Option dumpOnlyOption = OptionBuilder.withLongOpt("dump-only") - .withDescription("dumps the given dex file into a single annotated dump file named FILE (.dump by default), and does not generate the disassembly") - .hasOptionalArg() - .withArgName("FILE") - .create("D"); - Option writeDexOption = OptionBuilder.withLongOpt("write-dex") .withDescription("additionally rewrites the input dex file to FILE") .hasArg() @@ -245,13 +229,11 @@ public class main { .create("p"); OptionGroup dumpCommand = new OptionGroup(); - dumpCommand.addOption(dumpOption); - dumpCommand.addOption(dumpOnlyOption); - dumpCommand.addOption(readonlyOption); options.addOption(versionOption); options.addOption(helpOption); - options.addOptionGroup(dumpCommand); + options.addOption(dumpOption); + options.addOption(noDisassemblyOption); options.addOption(writeDexOption); options.addOption(outputDirOption); options.addOption(sortOption);