Skip to content

Commit

Permalink
Minimal command-line application
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatCraws committed Mar 9, 2024
1 parent 6c2cbfd commit b3a9388
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/main/java/de/esterlino/timeplater/TimeplaterApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,27 @@
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;

import de.esterlino.timeplater.worktimes.ouputter.MailTemplateWorkWeekOutputter;
import de.esterlino.timeplater.worktimes.supplier.ExcelWorkWeekSupplier;
import de.esterlino.timeplater.worktimes.supplier.ExcelWorkbookInitializationException;

public class TimeplaterApplication {

public static void main(String[] args) {
JFrame frame = new JFrame("My App");
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
if (args.length < 2) {
System.err.println("Too few arguments. Please enter: inputFile calendarWeek [outputFile]");
return;
}

SwingUtilities.invokeLater(() -> {
frame.setVisible(true);
});
ExcelWorkWeekSupplier supplier = null;
try {
supplier = new ExcelWorkWeekSupplier(args[0]);
} catch (ExcelWorkbookInitializationException e) {
e.printStackTrace(System.err);
return;
}

MailTemplateWorkWeekOutputter outputter = new MailTemplateWorkWeekOutputter(args.length >= 3 ? args[2] : "output.txt");
outputter.createOutput(supplier.supplyWorkWeek(Integer.parseInt(args[1])));
}
}

0 comments on commit b3a9388

Please sign in to comment.