refactored the options a bit

git-svn-id: https://smali.googlecode.com/svn/trunk@394 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-08-11 08:12:23 +00:00
parent a7ea38929b
commit f5f30468ad

View File

@ -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 (<dexfile>.dump by default), along with the normal disassembly.")
.withDescription("dumps the given dex file into a single annotated dump file named FILE" +
" (<dexfile>.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 (<dexfile>.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);