本文整理汇总了Java中org.docopt.Docopt类的典型用法代码示例。如果您正苦于以下问题:Java Docopt类的具体用法?Java Docopt怎么用?Java Docopt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Docopt类属于org.docopt包,在下文中一共展示了Docopt类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.docopt.Docopt; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
Map<String, Object> opts = new Docopt(DOC)
.withVersion(VERSION)
.parse(args);
if(hasOpt(opts, "verbose")) {
configureVerboseLogging();
}
LOGGER.debug(opts.toString());
String[] includedTables = initializeIncludedTables(opts);
List<Entity> entities;
try(DatabaseAnalyzer analyzer = initializeDatabaseAnalyzer(opts)) {
entities = analyzer.initializeEntities(includedTables);
LOGGER.debug("entities: "+ entities);
}
SchemaWriter writer = new SchemaWriter(getOpt(opts, "output-dir"));
writer.writeEntities(entities);
}
开发者ID:ebridges,项目名称:rdbms-to-graphql,代码行数:22,代码来源:RdbmsToGraphQL.java
示例2: main
import org.docopt.Docopt; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void main(final String[] args) throws Exception {
final Map<String, Object> opts = new Docopt(doc).parse(args);
final Configuration config = Configuration
.readYamlFile(opts.get("<dbconfig>").toString());
opts.putIfAbsent("--external", false);
if ((boolean) opts.get("server"))
Server.startServer(
new DatabaseService(prepareSql2o(config), config), config, (boolean) opts.get("--external"));
else if ((boolean) opts.get("import"))
DatabaseService.importTables(config, prepareSql2o(config));
else if ((boolean) opts.get("initialize"))
DatabaseService.initializeTables(prepareSql2o(config));
else if ((boolean) opts.get("demo")) {
final Sql2o sql2o = prepareSql2o(config);
DatabaseService.initializeTables(sql2o);
DatabaseService.importTables(config, sql2o);
Server.startServer(new DatabaseService(sql2o, config), config, (boolean) opts.get("--external"));
} else if ((boolean) opts.get("error"))
Server.startErrorServer(config,
(ArrayList<String>) opts.get("<message>"));
else
throw new IllegalArgumentException();
}
开发者ID:hellrich,项目名称:JeSemE,代码行数:26,代码来源:CLI.java
示例3: main
import org.docopt.Docopt; //导入依赖的package包/类
/**
* The main method for RMeteorJ.
*
* @param args Arguments for RMateorJ
*/
public static void main(String[] args) {
Map<String, Object> opts = new Docopt(doc).withVersion("RMeteorJ v0.1").parse(args);
if(opts.get("--nogui").equals(true)) {
log.info("Running in GUI-less mode");
GUI.enabled = false;
}
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
log.warn(e.getMessage());
}
if(GUI.enabled) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
ModuleManager.getManager().loadModules();
}
开发者ID:RMeteorJ,项目名称:RMeteorJ,代码行数:29,代码来源:Main.java
示例4: main
import org.docopt.Docopt; //导入依赖的package包/类
public static void main(String[] args) {
String version = Main.class.getPackage().getImplementationVersion();
Map<String, Object> opts =
new Docopt(doc)
.withVersion("HeapDL "+ (version == null ? "DEVELOPMENT" : version))
.parse(args);
MemoryAnalyser m = new MemoryAnalyser((String)opts.get("<hprof1>"), !((boolean) opts.get("--no-strings")));
}
开发者ID:plast-lab,项目名称:HeapDL,代码行数:10,代码来源:Main.java
示例5: main
import org.docopt.Docopt; //导入依赖的package包/类
public static void main(String[] args) {
logger.info("Running CLI with arguments {}", Arrays.toString(args));
try {
InputStream inputStream = Main.class.getResourceAsStream("/cli-specification.txt");
String doc = IOUtils.toString(inputStream);
Docopt docopt = new Docopt(doc);
Map<String, Object> opts = docopt
.withVersion("bromium 0.1")
.withHelp(true)
.withExit(false)
.parse(args);
Map<String, Supplier<Command>> commandToHandler = getCommands();
String selectedCommand = commandToHandler
.keySet()
.stream()
.filter(command -> opts.get(command).equals(true))
.findAny()
// we know that a command must be present because otherwise docopt would have stopped
.get();
injector = Guice.createInjector(new DefaultModule(selectedCommand, opts));
commandToHandler.get(selectedCommand).get().run();
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}
开发者ID:hristo-vrigazov,项目名称:bromium,代码行数:29,代码来源:Main.java
示例6: main
import org.docopt.Docopt; //导入依赖的package包/类
public static void main(final String[] args) {
final Map<String, Object> opts =
new Docopt(doc).withVersion("Naval Fate 2.0").parse(args);
System.out.println(opts);
}
开发者ID:docopt,项目名称:docopt.java,代码行数:6,代码来源:NavalFate.java
注:本文中的org.docopt.Docopt类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论