mirror of
https://github.com/revanced/smali.git
synced 2025-05-21 16:37:04 +02:00
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:
parent
a7ea38929b
commit
f5f30468ad
@ -73,7 +73,6 @@ public class main {
|
|||||||
boolean write = false;
|
boolean write = false;
|
||||||
boolean sort = false;
|
boolean sort = false;
|
||||||
boolean fixRegisters = false;
|
boolean fixRegisters = false;
|
||||||
boolean readOnly = false;
|
|
||||||
boolean noParameterRegisters = false;
|
boolean noParameterRegisters = false;
|
||||||
|
|
||||||
String outputDirectory = "out";
|
String outputDirectory = "out";
|
||||||
@ -100,8 +99,8 @@ public class main {
|
|||||||
|
|
||||||
inputDexFileName = remainingArgs[0];
|
inputDexFileName = remainingArgs[0];
|
||||||
|
|
||||||
if (commandLine.hasOption("r")) {
|
if (commandLine.hasOption("n")) {
|
||||||
readOnly = true;
|
disassemble = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commandLine.hasOption("d")) {
|
if (commandLine.hasOption("d")) {
|
||||||
@ -109,12 +108,6 @@ public class main {
|
|||||||
dumpFileName = commandLine.getOptionValue("d", inputDexFileName + ".dump");
|
dumpFileName = commandLine.getOptionValue("d", inputDexFileName + ".dump");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commandLine.hasOption("D")) {
|
|
||||||
doDump = true;
|
|
||||||
disassemble = false;
|
|
||||||
dumpFileName = commandLine.getOptionValue("D", inputDexFileName + ".dump");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (commandLine.hasOption("w")) {
|
if (commandLine.hasOption("w")) {
|
||||||
write = true;
|
write = true;
|
||||||
outputDexFileName = commandLine.getOptionValue("w");
|
outputDexFileName = commandLine.getOptionValue("w");
|
||||||
@ -146,10 +139,6 @@ public class main {
|
|||||||
//Read in and parse the dex file
|
//Read in and parse the dex file
|
||||||
DexFile dexFile = new DexFile(dexFileFile, !fixRegisters);
|
DexFile dexFile = new DexFile(dexFileFile, !fixRegisters);
|
||||||
|
|
||||||
if (readOnly) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (disassemble) {
|
if (disassemble) {
|
||||||
baksmali.disassembleDexFile(dexFile, outputDirectory, noParameterRegisters);
|
baksmali.disassembleDexFile(dexFile, outputDirectory, noParameterRegisters);
|
||||||
}
|
}
|
||||||
@ -202,22 +191,17 @@ public class main {
|
|||||||
.withDescription("prints the help message then exits")
|
.withDescription("prints the help message then exits")
|
||||||
.create("?");
|
.create("?");
|
||||||
|
|
||||||
Option readonlyOption = OptionBuilder.withLongOpt("read-only")
|
Option noDisassemblyOption = OptionBuilder.withLongOpt("no-disassembly")
|
||||||
.withDescription("reads in the dex file and then exits")
|
.withDescription("suppresses the output of the disassembly")
|
||||||
.create("r");
|
.create("n");
|
||||||
|
|
||||||
Option dumpOption = OptionBuilder.withLongOpt("dump-to")
|
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()
|
.hasOptionalArg()
|
||||||
.withArgName("FILE")
|
.withArgName("FILE")
|
||||||
.create("d");
|
.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")
|
Option writeDexOption = OptionBuilder.withLongOpt("write-dex")
|
||||||
.withDescription("additionally rewrites the input dex file to FILE")
|
.withDescription("additionally rewrites the input dex file to FILE")
|
||||||
.hasArg()
|
.hasArg()
|
||||||
@ -245,13 +229,11 @@ public class main {
|
|||||||
.create("p");
|
.create("p");
|
||||||
|
|
||||||
OptionGroup dumpCommand = new OptionGroup();
|
OptionGroup dumpCommand = new OptionGroup();
|
||||||
dumpCommand.addOption(dumpOption);
|
|
||||||
dumpCommand.addOption(dumpOnlyOption);
|
|
||||||
dumpCommand.addOption(readonlyOption);
|
|
||||||
|
|
||||||
options.addOption(versionOption);
|
options.addOption(versionOption);
|
||||||
options.addOption(helpOption);
|
options.addOption(helpOption);
|
||||||
options.addOptionGroup(dumpCommand);
|
options.addOption(dumpOption);
|
||||||
|
options.addOption(noDisassemblyOption);
|
||||||
options.addOption(writeDexOption);
|
options.addOption(writeDexOption);
|
||||||
options.addOption(outputDirOption);
|
options.addOption(outputDirOption);
|
||||||
options.addOption(sortOption);
|
options.addOption(sortOption);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user