mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-25 07:27:18 +01:00
Rename i.b.{BitsquareArgumentParser=>ArgumentParser}
This commit is contained in:
parent
55ef0b43d7
commit
8eb988616f
3 changed files with 19 additions and 25 deletions
|
@ -15,25 +15,23 @@
|
|||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.util;
|
||||
package io.bitsquare.app;
|
||||
|
||||
import io.bitsquare.network.BootstrapNode;
|
||||
|
||||
import net.sourceforge.argparse4j.ArgumentParsers;
|
||||
import net.sourceforge.argparse4j.inf.ArgumentParser;
|
||||
import net.sourceforge.argparse4j.inf.ArgumentParserException;
|
||||
import net.sourceforge.argparse4j.inf.Namespace;
|
||||
|
||||
/*
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-s, --seed Start as DHT seed peer, no UI. (default: false)
|
||||
-d PEERID, --peerid PEERID Seed peer ID. (default: digitalocean1.bitsquare.io)
|
||||
-p PORT, --port PORT IP port to listen on. (default: 5000)
|
||||
-i INTERFACE, --interface INTERFACE Network interface to listen on.
|
||||
-n NAME, --name NAME Append name to application name.
|
||||
*/
|
||||
public class BitsquareArgumentParser {
|
||||
public class ArgumentParser {
|
||||
|
||||
public static String PEER_ID_FLAG = "peerid";
|
||||
public static String PORT_FLAG = "port";
|
||||
|
@ -41,9 +39,9 @@ public class BitsquareArgumentParser {
|
|||
public static String INFHINT_FLAG = "interface";
|
||||
public static String NAME_FLAG = "name";
|
||||
|
||||
private final ArgumentParser parser;
|
||||
private final net.sourceforge.argparse4j.inf.ArgumentParser parser;
|
||||
|
||||
public BitsquareArgumentParser() {
|
||||
public ArgumentParser() {
|
||||
parser = ArgumentParsers.newArgumentParser("Bitsquare")
|
||||
.defaultHelp(true)
|
||||
.description("Bitsquare - The decentralized bitcoin exchange.");
|
||||
|
@ -67,8 +65,4 @@ public class BitsquareArgumentParser {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void handleError(ArgumentParserException e) {
|
||||
parser.handleError(e);
|
||||
}
|
||||
}
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
package io.bitsquare.app.cli;
|
||||
|
||||
import io.bitsquare.app.ArgumentParser;
|
||||
import io.bitsquare.msg.actor.DHTManager;
|
||||
import io.bitsquare.msg.actor.command.InitializePeer;
|
||||
import io.bitsquare.msg.actor.event.PeerInitialized;
|
||||
import io.bitsquare.network.BootstrapNode;
|
||||
import io.bitsquare.network.Node;
|
||||
import io.bitsquare.util.BitsquareArgumentParser;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
|
@ -50,25 +50,25 @@ public class SeedNode {
|
|||
private static String interfaceHint;
|
||||
|
||||
public static void main(String[] args) {
|
||||
BitsquareArgumentParser parser = new BitsquareArgumentParser();
|
||||
ArgumentParser parser = new ArgumentParser();
|
||||
Namespace namespace = parser.parseArgs(args);
|
||||
|
||||
if (namespace.getString(BitsquareArgumentParser.NAME_FLAG) != null) {
|
||||
appName = appName + "-" + namespace.getString(BitsquareArgumentParser.NAME_FLAG);
|
||||
if (namespace.getString(ArgumentParser.NAME_FLAG) != null) {
|
||||
appName = appName + "-" + namespace.getString(ArgumentParser.NAME_FLAG);
|
||||
}
|
||||
|
||||
if (namespace.getString(BitsquareArgumentParser.INFHINT_FLAG) != null) {
|
||||
interfaceHint = namespace.getString(BitsquareArgumentParser.INFHINT_FLAG);
|
||||
if (namespace.getString(ArgumentParser.INFHINT_FLAG) != null) {
|
||||
interfaceHint = namespace.getString(ArgumentParser.INFHINT_FLAG);
|
||||
}
|
||||
|
||||
int port = -1;
|
||||
if (namespace.getString(BitsquareArgumentParser.PORT_FLAG) != null) {
|
||||
port = Integer.valueOf(namespace.getString(BitsquareArgumentParser.PORT_FLAG));
|
||||
if (namespace.getString(ArgumentParser.PORT_FLAG) != null) {
|
||||
port = Integer.valueOf(namespace.getString(ArgumentParser.PORT_FLAG));
|
||||
}
|
||||
|
||||
String seedID = BootstrapNode.DIGITAL_OCEAN1.getId();
|
||||
if (namespace.getString(BitsquareArgumentParser.PEER_ID_FLAG) != null) {
|
||||
seedID = namespace.getString(BitsquareArgumentParser.PEER_ID_FLAG);
|
||||
if (namespace.getString(ArgumentParser.PEER_ID_FLAG) != null) {
|
||||
seedID = namespace.getString(ArgumentParser.PEER_ID_FLAG);
|
||||
}
|
||||
|
||||
ActorSystem actorSystem = ActorSystem.create(appName);
|
||||
|
@ -86,7 +86,7 @@ public class SeedNode {
|
|||
}
|
||||
}
|
||||
|
||||
int serverPort = (port == -1) ? BitsquareArgumentParser.PORT_DEFAULT : port;
|
||||
int serverPort = (port == -1) ? ArgumentParser.PORT_DEFAULT : port;
|
||||
|
||||
ActorRef seedNode = actorSystem.actorOf(DHTManager.getProps(), DHTManager.SEED_NAME);
|
||||
Inbox inbox = Inbox.create(actorSystem);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package io.bitsquare.app.gui;
|
||||
|
||||
import io.bitsquare.app.ArgumentParser;
|
||||
import io.bitsquare.app.BitsquareModule;
|
||||
import io.bitsquare.gui.Navigation;
|
||||
import io.bitsquare.gui.SystemTray;
|
||||
|
@ -26,7 +27,6 @@ import io.bitsquare.gui.util.ImageUtil;
|
|||
import io.bitsquare.persistence.Persistence;
|
||||
import io.bitsquare.settings.Settings;
|
||||
import io.bitsquare.user.User;
|
||||
import io.bitsquare.util.BitsquareArgumentParser;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
|
||||
|
@ -55,11 +55,11 @@ public class Main extends Application {
|
|||
private Injector injector;
|
||||
|
||||
public static void main(String[] args) {
|
||||
BitsquareArgumentParser parser = new BitsquareArgumentParser();
|
||||
ArgumentParser parser = new ArgumentParser();
|
||||
Namespace namespace = parser.parseArgs(args);
|
||||
|
||||
if (namespace.getString(BitsquareArgumentParser.NAME_FLAG) != null) {
|
||||
appName = appName + "-" + namespace.getString(BitsquareArgumentParser.NAME_FLAG);
|
||||
if (namespace.getString(ArgumentParser.NAME_FLAG) != null) {
|
||||
appName = appName + "-" + namespace.getString(ArgumentParser.NAME_FLAG);
|
||||
}
|
||||
|
||||
Application.launch(Main.class, args);
|
||||
|
|
Loading…
Add table
Reference in a new issue