Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added automatic mode selection #2168

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

TwoOfTwelve
Copy link
Contributor

Adds an implicit mode selection. The CLI will now detect the mode based on the input files.

From the documentation of the mode flag:
By default JPlag will automatically select the mode based on your input files. If none are selected the viewer will open on the file select screen. If a single result zip is selected it will be opened in the viewer directly. Otherwise JPlag will run on the submissions in the input files and show the result in the viewer.

@TwoOfTwelve TwoOfTwelve requested review from Kr0nox and tsaglam and removed request for Kr0nox January 29, 2025 19:42
@@ -115,6 +120,30 @@ public void runViewer(File zipFile) throws IOException {
JPlagRunner.runInternalServer(zipFile, this.inputHandler.getCliOptions().advanced.port);
}

private void selectModeAutomatically() throws IOException, ExitException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should quickly discuss if we want to move calls like runViewer(runJPlag()) into their own method like runModeRunAndView(), to make it clearer which mode got auto selected.

List<File> inputs = new ArrayList<>();
inputs.addAll(List.of(this.inputHandler.getCliOptions().newDirectories));
inputs.addAll(List.of(this.inputHandler.getCliOptions().oldDirectories));
inputs.addAll(List.of(this.inputHandler.getCliOptions().rootDirectory));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say we add the root directory first, just because it seems more logical

Copy link

@TwoOfTwelve
Copy link
Contributor Author

Adapt readme

Copy link
Member

@Kr0nox Kr0nox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocker, as a reminder that the above comments are change requests

@Kr0nox Kr0nox added this to the 6.0.0 milestone Jan 31, 2025
@Kr0nox
Copy link
Member

Kr0nox commented Feb 2, 2025

Also update the documentation

## Viewing Reports
Starting with version v6.0.0, the report viewer is bundled with JPlag and will be launched automatically. The `--mode` option controls this behavior.
By default, JPlag will process the input files and produce a zipped result file. After that, the report viewer is launched (on localhost), and the report will be shown in your browser.
The option `--mode show` will only open the report viewer.
This allows you to view existing reports.
You can optionally provide the path to a report file to immediately display it in the viewer; otherwise, the viewer will require you to select a report, just like the online version.
By specifying `--mode run`, JPlag will run but generate the zipped report but will not open the report viewer.
An online version of the viewer is still hosted at https://jplag.github.io/JPlag/ in order to view pre-v6.0.0 reports. Your submissions will neither be uploaded to a server nor stored permanently. They are stored as long as you view them. Once you refresh the page, all information will be erased.

Inspiration may be found here #2171 or just redirect to that section

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants