forked from I2P_Developers/i2p.i2p
i2psnark: Add CommandLine to jar
This commit is contained in:
@ -70,7 +70,7 @@
|
|||||||
<property name="workspace.changes.tr" value="" />
|
<property name="workspace.changes.tr" value="" />
|
||||||
<jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/web/* **/messages_*.class">
|
<jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/web/* **/messages_*.class">
|
||||||
<manifest>
|
<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="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" />
|
||||||
<attribute name="Implementation-Version" value="${full.version}" />
|
<attribute name="Implementation-Version" value="${full.version}" />
|
||||||
<attribute name="Built-By" value="${build.built-by}" />
|
<attribute name="Built-By" value="${build.built-by}" />
|
||||||
|
45
apps/i2psnark/java/src/org/klomp/snark/CommandLine.java
Normal file
45
apps/i2psnark/java/src/org/klomp/snark/CommandLine.java
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user