You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/04/06 15:05:43 UTC

[camel] branch main updated: camel-jbang - camel version list to filter with from/to

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 55322ebea7c camel-jbang - camel version list to filter with from/to
55322ebea7c is described below

commit 55322ebea7c46d1a037b3d46a0f38fce88848ade
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Apr 6 17:05:26 2023 +0200

    camel-jbang - camel version list to filter with from/to
---
 docs/user-manual/modules/ROOT/pages/camel-jbang.adoc    |  2 +-
 .../dsl/jbang/core/commands/version/VersionList.java    | 17 ++++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
index abb549a48d6..c5c58b00035 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
@@ -648,7 +648,7 @@ camel version list
 ----
 
 NOTE: The `version list` shows the latest releases going back a few versions, at this time of writing the minimum version
-is Camel 3.14. To show all Camel 3.x releases, you can specify `--minimum-version=3.0` and the list is longer.
+is Camel 3.14. To show all Camel 3.x releases, you can specify `--from-version=3.0` and the list is longer.
 The list can only go back to Camel 2.18, as we do not have all release meta-data for older releases.
 
 You can also show Camel releases for either Spring Boot or Quarkus using the `--runtime` option, such as:
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 7864db03df4..c2e6ff7fe0d 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
@@ -64,9 +64,13 @@ public class VersionList extends CamelCommand {
                         description = "Runtime (spring-boot, quarkus, or camel-main)")
     String runtime;
 
-    @CommandLine.Option(names = { "--minimum-version" },
-                        description = "Minimum Camel version to avoid resolving too old releases", defaultValue = "3.14.0")
-    String minimumVersion = "3.14.0";
+    @CommandLine.Option(names = { "--from-version" },
+                        description = "Filter by Camel version (inclusive)", defaultValue = "3.14.0")
+    String fromVersion = "3.14.0";
+
+    @CommandLine.Option(names = { "--to-version" },
+                        description = "Filter by Camel version (exclusive)")
+    String toVersion;
 
     @CommandLine.Option(names = { "--repo" }, description = "Maven repository for downloading available versions")
     String repo;
@@ -104,7 +108,7 @@ public class VersionList extends CamelCommand {
                 a = "camel-quarkus-catalog";
             }
 
-            versions = downloader.resolveAvailableVersions(g, a, minimumVersion, repo);
+            versions = downloader.resolveAvailableVersions(g, a, fromVersion, repo);
             versions = versions.stream().filter(v -> acceptVersion(v[0])).collect(Collectors.toList());
 
             main.stop();
@@ -226,7 +230,10 @@ public class VersionList extends CamelCommand {
         if (version == null) {
             return false;
         }
-        return VersionHelper.isGE(version, minimumVersion);
+        if (fromVersion != null && toVersion != null) {
+            return VersionHelper.isBetween(version, fromVersion, toVersion);
+        }
+        return VersionHelper.isGE(version, fromVersion);
     }
 
     private ReleaseModel onlineRelease(String runtime, String coreVersion) throws Exception {