use of org.eclipse.winery.tools.copybaragenerator.CopybaraGenerator in project winery by eclipse.
the class WineryCli method main.
public static void main(String[] args) throws Exception {
Option repositoryPathOption = new Option("p", "path", true, "use given path as repository path");
Option serviceTemplatesOnlyOption = new Option("so", "servicetemplatesonly", false, "checks service templates instead of the whole repository");
Option checkDocumentationOption = new Option("cd", "checkdocumentation", false, "check existence of README.md and LICENSE. Default: No check");
Option verboseOption = new Option("v", "verbose", false, "be verbose: Output the checked elements");
Option generateCopybaraConfigOption = new Option("cb", "generatecopybaraconfig", true, "Generates a configuration for Copybara.");
generateCopybaraConfigOption.setOptionalArg(true);
Option helpOption = new Option("h", "help", false, "prints this help");
Options options = new Options();
options.addOption(repositoryPathOption);
options.addOption(serviceTemplatesOnlyOption);
options.addOption(checkDocumentationOption);
options.addOption(verboseOption);
options.addOption(generateCopybaraConfigOption);
options.addOption(helpOption);
CommandLineParser parser = new DefaultParser();
CommandLine line = parser.parse(options, args);
if (line.hasOption("h")) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("winery", options);
System.exit(0);
}
IRepository repository;
if (line.hasOption("p")) {
repository = RepositoryFactory.getRepository(Paths.get(line.getOptionValue("p")));
} else {
repository = RepositoryFactory.getRepository();
}
if (line.hasOption("cb")) {
CopybaraGenerator copybaraGenerator = new CopybaraGenerator();
String outfile = line.getOptionValue("cb");
if (outfile == null) {
String copybaraConfigFile = copybaraGenerator.generateCopybaraConfigFile();
System.out.println(copybaraConfigFile);
} else {
Path file = Paths.get(outfile);
copybaraGenerator.generateCopybaraConfigFile(file);
}
System.exit(0);
}
if (repository instanceof AbstractFileBasedRepository) {
System.out.println("Using repository path " + repository.getRepositoryRoot() + "...");
} else {
System.out.println("Using non-filebased repository");
}
doConsistencyCheck(line, repository);
}
Aggregations