use of tools.utils.ToolTask in project AuthMeReloaded by AuthMe.
the class ToolsRunner method promptAndExecuteTask.
private void promptAndExecuteTask() {
System.out.println("The following tasks are available:");
for (String key : tasks.keySet()) {
System.out.println("- " + key);
}
System.out.println("Please enter the task to run:");
Scanner scanner = new Scanner(System.in);
String inputTask = scanner.nextLine();
ToolTask task = tasks.get(inputTask);
if (task != null) {
task.execute(scanner);
} else {
System.out.println("Unknown task");
}
scanner.close();
}
use of tools.utils.ToolTask in project AuthMeReloaded by AuthMe.
the class UpdateDocsTask method executeTasks.
private void executeTasks(Consumer<ToolTask> taskRunner) {
for (ToolTask task : getDocTasks()) {
System.out.println("\nRunning " + task.getTaskName() + "\n-------------------");
taskRunner.accept(task);
}
}
use of tools.utils.ToolTask in project AuthMeReloaded by AuthMe.
the class ToolsRunner method main.
/**
* Entry point of the runner.
*
* @param args .
*/
public static void main(String... args) {
// Note ljacqu 20151212: If the tools folder becomes a lot bigger, it will make sense to restrict the depth
// of this recursive collector
ClassCollector collector = new ClassCollector(TestHelper.TEST_SOURCES_FOLDER, "tools");
Map<String, ToolTask> tasks = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
for (ToolTask task : collector.getInstancesOfType(ToolTask.class)) {
tasks.put(task.getTaskName(), task);
}
ToolsRunner runner = new ToolsRunner(tasks);
if (args == null || args.length == 0) {
runner.promptAndExecuteTask();
} else {
runner.executeAutomaticTasks(args);
}
}
Aggregations