Skip to content

Commit

Permalink
feat: add cmd param to get current version
Browse files Browse the repository at this point in the history
  • Loading branch information
rvullriede committed Dec 9, 2024
1 parent b2e67b5 commit 1e9980f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-release-on-main-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
max-parallel: 1 # otherwise the release upload will fail
matrix:
os: [ macos-14, macos-13, windows-latest, ubuntu] # ubuntu-latest, windows-latest, macos-13,
os: [ macos-14, macos-13, windows-latest, ubuntu-latest ]

runs-on: ${{ matrix.os }}

Expand Down
12 changes: 7 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>net.osslabz</groupId>
<artifactId>log-gazer</artifactId>
<version>1.1.6</version>
<version>1.2.0</version>

<properties>
<osslabz.encoding>UTF-8</osslabz.encoding>
Expand All @@ -18,8 +18,6 @@
<maven.compiler.release>${osslabz.java.version}</maven.compiler.release>

<mainClass>net.osslabz.loggazer.LogGazerApp</mainClass>

<jpackage.maven.plugin.version>1.6.5</jpackage.maven.plugin.version>
</properties>

<licenses>
Expand Down Expand Up @@ -183,6 +181,7 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
Expand Down Expand Up @@ -217,6 +216,7 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
Expand Down Expand Up @@ -251,6 +251,7 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
Expand Down Expand Up @@ -312,7 +313,7 @@
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${mainClass}</mainClass>
</transformer>
</transformers>
Expand All @@ -328,6 +329,7 @@
<archive>
<manifest>
<mainClass>${mainClass}</mainClass>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
Expand Down
41 changes: 29 additions & 12 deletions src/main/java/net/osslabz/loggazer/LogGazerApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javafx.application.Application;
import javafx.concurrent.Task;
import javafx.scene.Scene;
Expand Down Expand Up @@ -77,6 +76,24 @@ public class LogGazerApp extends Application {

public static void main(String[] args) {

if (args != null && args.length == 1) {
String singleParam = args[0];
if (singleParam != null) {
String paramLowerCase = StringUtils.stripStart(singleParam.trim().toLowerCase(), "-");
if (paramLowerCase.equals("version") || paramLowerCase.equals("v")) {
System.out.printf(
"""
log-gazer %s%n
Copyright (C) 2024 Raphael Vullriede ([email protected])%n
License: Apache License Version 2.0, January 2004 <https://www.apache.org/licenses/LICENSE-2.0.txt>.%n
This is free software: you are free to change and redistribute it.%n
There is NO WARRANTY, to the extent permitted by law.%n
""", LogGazerApp.class.getPackage().getImplementationVersion());
System.exit(0);
}
}
}

launch(args);
}

Expand Down Expand Up @@ -175,15 +192,15 @@ private ToolBar createToolBar() {
resetSearch();

toolBar.getItems().addAll(
this.buttonFormatJson,
new Separator(),
this.buttonMarkLogLevel,
new Separator(),
this.searchField,
this.searchButton,
this.prevMatchButton,
this.nextMatchButton,
this.matchCountLabel
this.buttonFormatJson,
new Separator(),
this.buttonMarkLogLevel,
new Separator(),
this.searchField,
this.searchButton,
this.prevMatchButton,
this.nextMatchButton,
this.matchCountLabel

);

Expand Down Expand Up @@ -237,7 +254,7 @@ private void navigateToCurrentMatch() {
int numMatches = tabContent.getSearchData().numMatches();

searchField.setText(StringUtils.isNotBlank(tabContent.getSearchData().getQuery()) ? tabContent.getSearchData().getQuery() :
SEARCH_QUERY_PLACEHOLDER);
SEARCH_QUERY_PLACEHOLDER);
matchCountLabel.setText(String.format("%d of %d matches", currentMatchIndex + 1, numMatches));

if (currentMatchIndex >= 0 && currentMatchIndex < numMatches) {
Expand Down Expand Up @@ -470,7 +487,7 @@ private void openFile() {
new FileChooser.ExtensionFilter("Compressed Files", "*.gz", "*.zip", "*.tar.gz")
*/
new FileChooser.ExtensionFilter("Files", "*.*")
new FileChooser.ExtensionFilter("Files", "*.*")

);
File file = fileChooser.showOpenDialog(null);
Expand Down

0 comments on commit 1e9980f

Please sign in to comment.