Add help message display.
This commit is contained in:
parent
cae44b6f85
commit
2d4609e9e8
|
@ -44,9 +44,20 @@ public class Main
|
||||||
|
|
||||||
public static void main(String[] argv)
|
public static void main(String[] argv)
|
||||||
{
|
{
|
||||||
instance = new Main();
|
|
||||||
Args args = new Args();
|
Args args = new Args();
|
||||||
JCommander.newBuilder().addObject(args).build().parse(argv);
|
JCommander jCommander = JCommander.newBuilder()
|
||||||
|
.addObject(args)
|
||||||
|
.programName("FriendCloud")
|
||||||
|
.build();
|
||||||
|
jCommander.parse(argv);
|
||||||
|
|
||||||
|
if (args.help)
|
||||||
|
{
|
||||||
|
jCommander.usage();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
instance = new Main();
|
||||||
instance.args = args;
|
instance.args = args;
|
||||||
|
|
||||||
System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "Info");
|
System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "Info");
|
||||||
|
@ -66,6 +77,7 @@ public class Main
|
||||||
|
|
||||||
private void run() throws IOException
|
private void run() throws IOException
|
||||||
{
|
{
|
||||||
|
|
||||||
DataStore dataStore = new StupidJSONFileStore(new File(args.storageLocation));
|
DataStore dataStore = new StupidJSONFileStore(new File(args.storageLocation));
|
||||||
controller = new Controller(dataStore);
|
controller = new Controller(dataStore);
|
||||||
|
|
||||||
|
@ -216,23 +228,32 @@ public class Main
|
||||||
@SuppressWarnings("FieldCanBeLocal")
|
@SuppressWarnings("FieldCanBeLocal")
|
||||||
public static class Args
|
public static class Args
|
||||||
{
|
{
|
||||||
@Parameter(names="-share")
|
@Parameter(names="-help", help = true, description = "Display this help message and quit.")
|
||||||
|
private boolean help = false;
|
||||||
|
|
||||||
|
@Parameter(names="-share", description = "Add a file path to be shared once the application starts.")
|
||||||
private List<String> sharedFilePaths = new ArrayList<>();
|
private List<String> sharedFilePaths = new ArrayList<>();
|
||||||
|
|
||||||
@Parameter(names="-known-peer")
|
@Parameter(names="-known-peer", description = "Add a URI (e.g. tcp://192.168.1.69:42069) of a known peer that will be connected to on first run.")
|
||||||
private List<String> knownPeers = new ArrayList<>();
|
private List<String> knownPeers = new ArrayList<>();
|
||||||
|
|
||||||
@Parameter(names="-tcp-port")
|
@Parameter(names="-tcp-port", description = "The TCP port to listen for connections on.")
|
||||||
private int tcpPort = 7777;
|
private int tcpPort = 7777;
|
||||||
|
|
||||||
@Parameter(names="-no-upnp")
|
@Parameter(names="-advertise-address", description = "Manually add a URI (e.g. tcp://192.168.1.69:42069) that will be given to other peers to connect to this peer with. Useful to provide your global IP if UPnP doesn't work.")
|
||||||
|
private List<String> advertiseAddresses = new ArrayList<>();
|
||||||
|
|
||||||
|
@Parameter(names="-no-upnp", description = "Disables UPnP.")
|
||||||
private boolean noUpnp = false;
|
private boolean noUpnp = false;
|
||||||
|
|
||||||
@Parameter(names="-create-network")
|
// @Parameter(names="-create-network")
|
||||||
private boolean createNetwork = false;
|
// private boolean createNetwork = false;
|
||||||
|
|
||||||
@Parameter(names = "-storage")
|
@Parameter(names = "-storage", description = "The location on disk where the local copy of the state database will be stored.")
|
||||||
private String storageLocation = ".";
|
private String storageLocation = "./storage";
|
||||||
|
|
||||||
|
@Parameter(names = "-artificial-lag", description = "Set to a value above 0 to introduce artificial delay when sending messages, in milliseconds. Use for testing only!")
|
||||||
|
private int artificialLagMs = 0;
|
||||||
|
|
||||||
public List<String> getSharedFilePaths()
|
public List<String> getSharedFilePaths()
|
||||||
{
|
{
|
||||||
|
@ -254,14 +275,24 @@ public class Main
|
||||||
return noUpnp;
|
return noUpnp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCreateNetwork()
|
// public boolean isCreateNetwork()
|
||||||
{
|
// {
|
||||||
return createNetwork;
|
// return createNetwork;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public String getStorageLocation()
|
public String getStorageLocation()
|
||||||
{
|
{
|
||||||
return storageLocation;
|
return storageLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getAdvertiseAddresses()
|
||||||
|
{
|
||||||
|
return advertiseAddresses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getArtificialLagMs()
|
||||||
|
{
|
||||||
|
return artificialLagMs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue