[java-shib-shared] branch main updated: Provide option to stop consuming additional arg as a Spring resource.

Codeberg noreply at shibboleth.net
Wed Jul 29 14:03:09 UTC 2026


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch main
in repository java-shib-shared.

View the commit online:
https://codeberg.org/Shibboleth/java-shib-shared/commit/f5c31a4130adb543ebb31584855e4f8e95d17230

The following commit(s) were added to refs/heads/main by this push:
     new f5c31a41 Provide option to stop consuming additional arg as a Spring resource.
f5c31a41 is described below

commit f5c31a4130adb543ebb31584855e4f8e95d17230
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Wed Jul 29 09:59:40 2026 -0400

    Provide option to stop consuming additional arg as a Spring resource.
---
 .../shibboleth/shared/cli/AbstractCommandLine.java   | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/shib-cli/src/main/java/net/shibboleth/shared/cli/AbstractCommandLine.java b/shib-cli/src/main/java/net/shibboleth/shared/cli/AbstractCommandLine.java
index c860046c..753ce659 100644
--- a/shib-cli/src/main/java/net/shibboleth/shared/cli/AbstractCommandLine.java
+++ b/shib-cli/src/main/java/net/shibboleth/shared/cli/AbstractCommandLine.java
@@ -131,12 +131,15 @@ public abstract class AbstractCommandLine<T extends CommandLineArguments> {
     /** Whether options are case-sensitive. */
     private boolean caseSensitiveOptions = true;
     
+    /** Whether first argument is implicitly a Spring resource. */
+    private boolean consumeFirstOtherArgument = true;
+    
     /** Spring context. */
     @Nullable private GenericApplicationContext applicationContext;
 
     /** Optional Context initialized. */
     @Nullable private ApplicationContextInitializer<? super FilesystemGenericApplicationContext> contextInitializer;
-
+    
     /**
      * Sets whether JCommander parses options case-sensitively or not.
      * 
@@ -149,6 +152,19 @@ public abstract class AbstractCommandLine<T extends CommandLineArguments> {
     protected void setCaseSensitiveOptions(final boolean flag) {
         caseSensitiveOptions = flag;
     }
+
+    /**
+     * Sets whether to treat the first "other" argument as a Spring resource to load.
+     * 
+     * <p>Defaults to true.</p>
+     * 
+     * @param flag flag to set
+     * 
+     * @since 9.3.0
+     */
+    protected void setConsumeFirstOtherArgument(final boolean flag) {
+        consumeFirstOtherArgument = flag;
+    }
     
     /**
      * Set a context initializer.
@@ -280,7 +296,7 @@ public abstract class AbstractCommandLine<T extends CommandLineArguments> {
             final List<Resource> additionalConfigs = getAdditionalSpringResources();
 
             final List<Resource> configs = new ArrayList<>(1+additionalConfigs.size());
-            if (args.getOtherArgs().size() > 0) {
+            if (consumeFirstOtherArgument && args.getOtherArgs().size() > 0) {
                 configs.add(loader.getResource(args.getOtherArgs().get(0)));
             }
             configs.addAll(additionalConfigs);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list