Move the HelpFormatter subclass to the util project and use it for both smali and baksmali

git-svn-id: https://smali.googlecode.com/svn/trunk@667 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2010-03-03 07:12:06 +00:00
parent c616a0dadc
commit 6786055f35
5 changed files with 11 additions and 52 deletions

View File

@ -1,42 +0,0 @@
/*
* [The "BSD licence"]
* Copyright (c) 2010 Ben Gruver (JesusFreke)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.jf.baksmali;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
public class baksmaliHelpFormatter extends HelpFormatter {
public void baksmaliHelpFormatter() {
}
public void renderOptions(StringBuffer sb, Options options) {
super.renderOptions(sb, getWidth(), options, getLeftPadding(), this.getDescPadding());
}
}

View File

@ -30,7 +30,7 @@ package org.jf.baksmali;
import org.apache.commons.cli.*;
import org.jf.dexlib.DexFile;
import org.jf.util.ConsoleUtil;
import org.jf.util.*;
import java.io.File;
import java.io.InputStream;
@ -294,7 +294,7 @@ public class main {
* Prints the usage message.
*/
private static void usage(boolean printDebugOptions) {
baksmaliHelpFormatter formatter = new baksmaliHelpFormatter();
smaliHelpFormatter formatter = new smaliHelpFormatter();
formatter.setWidth(ConsoleUtil.getConsoleWidth());
formatter.printHelp("java -jar baksmali.jar [options] <dex-file>",

View File

@ -31,18 +31,12 @@ package org.jf.smali;
import org.apache.commons.cli.*;
import org.jf.dexlib.DexFile;
import org.jf.dexlib.CodeItem;
import org.jf.dexlib.Code.InstructionIterator;
import org.jf.dexlib.Code.Opcode;
import org.jf.dexlib.Code.Format.Format;
import org.jf.dexlib.Util.ByteArrayAnnotatedOutput;
import org.jf.dexlib.Util.FileUtils;
import org.antlr.runtime.ANTLRInputStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.TokenRewriteStream;
import org.antlr.runtime.Lexer;
import org.antlr.runtime.tree.CommonTree;
import org.antlr.runtime.tree.CommonTreeNodeStream;
import org.jf.util.ConsoleUtil;
import org.jf.util.*;
import java.io.*;
import java.util.Set;

View File

@ -10,4 +10,11 @@
<artifactId>smali-pom</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</project>

View File

@ -26,7 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.jf.smali;
package org.jf.util;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;