This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new d00073af5e9 CAMEL-21852: camel-jbang - camel version list - add option 
to only show active releases
d00073af5e9 is described below

commit d00073af5e9c8cf5879f71ea9e6a2a5b23e2d7ad
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Mar 11 09:33:39 2025 +0100

    CAMEL-21852: camel-jbang - camel version list - add option to only show 
active releases
---
 .../jbang/core/commands/version/VersionList.java   | 27 ++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/version/VersionList.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/version/VersionList.java
index 5f60959a397..5083b0fc6e6 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/version/VersionList.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/version/VersionList.java
@@ -87,20 +87,23 @@ public class VersionList extends CamelCommand {
     @CommandLine.Option(names = { "--repo" }, description = "Maven repository 
for downloading available versions")
     String repo;
 
-    @CommandLine.Option(names = { "--lts" }, description = "Only show LTS 
supported releases")
+    @CommandLine.Option(names = { "--lts" }, description = "Only show LTS 
supported releases", defaultValue = "false")
     boolean lts;
 
+    @CommandLine.Option(names = { "--eol" }, description = "Include releases 
that are end-of-life", defaultValue = "true")
+    boolean eol = true;
+
     @CommandLine.Option(names = { "--patch" }, description = "Whether to 
include patch releases (x.y.z)", defaultValue = "true")
     boolean patch = true;
 
     @CommandLine.Option(names = { "--rc" }, description = "Include also 
milestone or RC releases", defaultValue = "false")
     boolean rc;
 
-    @CommandLine.Option(names = { "--fresh" }, description = "Make sure we use 
fresh (i.e. non-cached) resources")
+    @CommandLine.Option(names = { "--fresh" }, description = "Make sure we use 
fresh (i.e. non-cached) resources",
+                        defaultValue = "false")
     boolean fresh;
 
-    @CommandLine.Option(names = { "--json" },
-                        description = "Output in JSON Format")
+    @CommandLine.Option(names = { "--json" }, description = "Output in JSON 
Format", defaultValue = "false")
     boolean jsonOutput;
 
     public VersionList(CamelJBangMain main) {
@@ -149,6 +152,22 @@ public class VersionList extends CamelCommand {
                 return !"0".equals(last);
             });
         }
+        if (!eol) {
+            SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD);
+            Date now = new Date();
+            rows.removeIf(r -> {
+                String eol = r.eolDate;
+                if (eol != null) {
+                    try {
+                        Date d = sdf.parse(r.eolDate);
+                        return d.before(now);
+                    } catch (Exception e) {
+                        // ignore
+                    }
+                }
+                return false;
+            });
+        }
 
         // sort rows
         rows.sort(this::sortRow);

Reply via email to