Skip to content

Commit 1e9980f

Browse files
committed
feat: add cmd param to get current version
1 parent b2e67b5 commit 1e9980f

File tree

3 files changed

+37
-18
lines changed

3 files changed

+37
-18
lines changed

.github/workflows/build-release-on-main-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
max-parallel: 1 # otherwise the release upload will fail
1818
matrix:
19-
os: [ macos-14, macos-13, windows-latest, ubuntu] # ubuntu-latest, windows-latest, macos-13,
19+
os: [ macos-14, macos-13, windows-latest, ubuntu-latest ]
2020

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

pom.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

66
<groupId>net.osslabz</groupId>
77
<artifactId>log-gazer</artifactId>
8-
<version>1.1.6</version>
8+
<version>1.2.0</version>
99

1010
<properties>
1111
<osslabz.encoding>UTF-8</osslabz.encoding>
@@ -18,8 +18,6 @@
1818
<maven.compiler.release>${osslabz.java.version}</maven.compiler.release>
1919

2020
<mainClass>net.osslabz.loggazer.LogGazerApp</mainClass>
21-
22-
<jpackage.maven.plugin.version>1.6.5</jpackage.maven.plugin.version>
2321
</properties>
2422

2523
<licenses>
@@ -183,6 +181,7 @@
183181
<build>
184182
<plugins>
185183
<plugin>
184+
<groupId>org.apache.maven.plugins</groupId>
186185
<artifactId>maven-assembly-plugin</artifactId>
187186
<version>3.7.1</version>
188187
<configuration>
@@ -217,6 +216,7 @@
217216
<build>
218217
<plugins>
219218
<plugin>
219+
<groupId>org.apache.maven.plugins</groupId>
220220
<artifactId>maven-assembly-plugin</artifactId>
221221
<version>3.7.1</version>
222222
<configuration>
@@ -251,6 +251,7 @@
251251
<build>
252252
<plugins>
253253
<plugin>
254+
<groupId>org.apache.maven.plugins</groupId>
254255
<artifactId>maven-assembly-plugin</artifactId>
255256
<version>3.7.1</version>
256257
<configuration>
@@ -312,7 +313,7 @@
312313
<configuration>
313314
<transformers>
314315
<transformer
315-
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
316+
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
316317
<mainClass>${mainClass}</mainClass>
317318
</transformer>
318319
</transformers>
@@ -328,6 +329,7 @@
328329
<archive>
329330
<manifest>
330331
<mainClass>${mainClass}</mainClass>
332+
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
331333
</manifest>
332334
</archive>
333335
</configuration>

src/main/java/net/osslabz/loggazer/LogGazerApp.java

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import java.util.UUID;
1212
import java.util.concurrent.ExecutorService;
1313
import java.util.concurrent.Executors;
14-
1514
import javafx.application.Application;
1615
import javafx.concurrent.Task;
1716
import javafx.scene.Scene;
@@ -77,6 +76,24 @@ public class LogGazerApp extends Application {
7776

7877
public static void main(String[] args) {
7978

79+
if (args != null && args.length == 1) {
80+
String singleParam = args[0];
81+
if (singleParam != null) {
82+
String paramLowerCase = StringUtils.stripStart(singleParam.trim().toLowerCase(), "-");
83+
if (paramLowerCase.equals("version") || paramLowerCase.equals("v")) {
84+
System.out.printf(
85+
"""
86+
log-gazer %s%n
87+
Copyright (C) 2024 Raphael Vullriede (raphael@osslabz.net)%n
88+
License: Apache License Version 2.0, January 2004 <https://www.apache.org/licenses/LICENSE-2.0.txt>.%n
89+
This is free software: you are free to change and redistribute it.%n
90+
There is NO WARRANTY, to the extent permitted by law.%n
91+
""", LogGazerApp.class.getPackage().getImplementationVersion());
92+
System.exit(0);
93+
}
94+
}
95+
}
96+
8097
launch(args);
8198
}
8299

@@ -175,15 +192,15 @@ private ToolBar createToolBar() {
175192
resetSearch();
176193

177194
toolBar.getItems().addAll(
178-
this.buttonFormatJson,
179-
new Separator(),
180-
this.buttonMarkLogLevel,
181-
new Separator(),
182-
this.searchField,
183-
this.searchButton,
184-
this.prevMatchButton,
185-
this.nextMatchButton,
186-
this.matchCountLabel
195+
this.buttonFormatJson,
196+
new Separator(),
197+
this.buttonMarkLogLevel,
198+
new Separator(),
199+
this.searchField,
200+
this.searchButton,
201+
this.prevMatchButton,
202+
this.nextMatchButton,
203+
this.matchCountLabel
187204

188205
);
189206

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

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

243260
if (currentMatchIndex >= 0 && currentMatchIndex < numMatches) {
@@ -470,7 +487,7 @@ private void openFile() {
470487
471488
new FileChooser.ExtensionFilter("Compressed Files", "*.gz", "*.zip", "*.tar.gz")
472489
*/
473-
new FileChooser.ExtensionFilter("Files", "*.*")
490+
new FileChooser.ExtensionFilter("Files", "*.*")
474491

475492
);
476493
File file = fileChooser.showOpenDialog(null);

0 commit comments

Comments
 (0)