mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-05-15 04:52:15 -04:00
UpdateFX with maven build (tested only on mac)
This commit is contained in:
parent
491e15c3de
commit
6b4f528f47
706 changed files with 6520 additions and 737 deletions
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* This file is part of Bitsquare.
|
||||
*
|
||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.app;
|
||||
|
||||
import joptsimple.OptionException;
|
||||
import joptsimple.OptionParser;
|
||||
import joptsimple.OptionSet;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static java.lang.String.*;
|
||||
|
||||
public abstract class BitsquareExecutable {
|
||||
public static final int EXIT_SUCCESS = 0;
|
||||
public static final int EXIT_FAILURE = 1;
|
||||
public static final String HELP_KEY = "help";
|
||||
|
||||
public void execute(String[] args) throws Exception {
|
||||
OptionParser parser = new OptionParser();
|
||||
parser.accepts(HELP_KEY, "This help text").forHelp();
|
||||
|
||||
this.customizeOptionParsing(parser);
|
||||
|
||||
OptionSet options;
|
||||
try {
|
||||
options = parser.parse(args);
|
||||
if (options.has(HELP_KEY)) {
|
||||
parser.printHelpOn(System.out);
|
||||
System.exit(EXIT_SUCCESS);
|
||||
return;
|
||||
}
|
||||
} catch (OptionException ex) {
|
||||
System.out.println("error: " + ex.getMessage());
|
||||
System.out.println();
|
||||
parser.printHelpOn(System.out);
|
||||
System.exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
this.doExecute(options);
|
||||
}
|
||||
|
||||
protected abstract void customizeOptionParsing(OptionParser parser);
|
||||
|
||||
protected static String description(String descText, Object defaultValue) {
|
||||
String description = "";
|
||||
if (StringUtils.hasText(descText))
|
||||
description = description.concat(descText);
|
||||
if (defaultValue != null)
|
||||
description = join(" ", description, format("(default: %s)", defaultValue));
|
||||
return description;
|
||||
}
|
||||
|
||||
protected abstract void doExecute(OptionSet options);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue