Skip to content

Commit

Permalink
Improved code style
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoOfTwelve committed Feb 5, 2025
1 parent 9592d66 commit ea69c5b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions cli/src/main/java/de/jplag/cli/CLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void executeCli() throws ExitException, IOException {
switch (this.inputHandler.getCliOptions().mode) {
case RUN -> runJPlag();
case VIEW -> runViewer(null);
case RUN_AND_VIEW -> runViewer(runJPlag());
case RUN_AND_VIEW -> runAndView();
case AUTO -> selectModeAutomatically();
}
}
Expand Down Expand Up @@ -110,6 +110,15 @@ public File runJPlag() throws ExitException, FileNotFoundException {
return target;
}

/**
* Runs JPlag and shows the result in the report viewer
* @throws IOException If something went wrong with the internal server
* @throws ExitException If JPlag threw an exception
*/
public void runAndView() throws IOException, ExitException {
runViewer(runJPlag());
}

/**
* Runs the report viewer using the given file as the default result.zip.
* @param zipFile The zip file to pass to the viewer. Can be null, if no result should be opened by default
Expand All @@ -133,14 +142,14 @@ private void selectModeAutomatically() throws IOException, ExitException {
return;
}

this.runViewer(this.runJPlag());
this.runAndView();
}

private List<File> getAllInputs() {
List<File> inputs = new ArrayList<>();
inputs.addAll(List.of(this.inputHandler.getCliOptions().rootDirectory));
inputs.addAll(List.of(this.inputHandler.getCliOptions().newDirectories));
inputs.addAll(List.of(this.inputHandler.getCliOptions().oldDirectories));
inputs.addAll(List.of(this.inputHandler.getCliOptions().rootDirectory));
return inputs;
}

Expand Down

0 comments on commit ea69c5b

Please sign in to comment.