diff --git a/apps/i2psnark/java/build.xml b/apps/i2psnark/java/build.xml index 2cbcd2ea88504b3b28fe97da7bccad00577c6afc..83c0f514a910f243aadf7435b928f2a7e4104ab9 100644 --- a/apps/i2psnark/java/build.xml +++ b/apps/i2psnark/java/build.xml @@ -70,7 +70,7 @@ <property name="workspace.changes.tr" value="" /> <jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/web/* **/messages_*.class"> <manifest> - <attribute name="Main-Class" value="org.klomp.snark.Snark" /> + <attribute name="Main-Class" value="org.klomp.snark.CommandLine" /> <attribute name="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" /> <attribute name="Implementation-Version" value="${full.version}" /> <attribute name="Built-By" value="${build.built-by}" /> diff --git a/apps/i2psnark/java/src/org/klomp/snark/CommandLine.java b/apps/i2psnark/java/src/org/klomp/snark/CommandLine.java new file mode 100644 index 0000000000000000000000000000000000000000..f82943704c36ef664d46f04ae094d27e076e340b --- /dev/null +++ b/apps/i2psnark/java/src/org/klomp/snark/CommandLine.java @@ -0,0 +1,45 @@ +package org.klomp.snark; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import net.i2p.CoreVersion; + +/** + * Simple command line access to various utilities. + * Not a public API. Subject to change. + * Apps and plugins should use specific classes. + * + * @since 0.9.26 + */ +public class CommandLine extends net.i2p.util.CommandLine { + + protected static final List<String> SCLASSES = Arrays.asList(new String[] { + "org.klomp.snark.MetaInfo", + //"org.klomp.snark.Snark", + //"org.klomp.snark.StaticSnark", + "org.klomp.snark.Storage", + "org.klomp.snark.bencode.BDecoder", + //"org.klomp.snark.web.RunStandalone", + }); + + protected CommandLine() {} + + public static void main(String args[]) { + List<String> classes = new ArrayList<String>(SCLASSES.size() + CLASSES.size()); + classes.addAll(SCLASSES); + classes.addAll(CLASSES); + if (args.length > 0) { + exec(args, classes); + } + usage(classes); + System.exit(1); + } + + private static void usage(List<String> classes) { + System.err.println("I2PSnark version " + CoreVersion.VERSION + '\n' + + "USAGE: java -jar /path/to/i2psnark.jar command [args]"); + printCommands(classes); + } +}