You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2019/01/29 08:41:34 UTC

[camel-k] branch master updated: Aggregate multiple occurences of the same run command CLI option into a comma-separated string configuration

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

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/master by this push:
     new f3044c7  Aggregate multiple occurences of the same run command CLI option into a comma-separated string configuration
f3044c7 is described below

commit f3044c7af4b754690a5547e29aa604b2379fa2bb
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Mon Jan 28 14:24:15 2019 +0100

    Aggregate multiple occurences of the same run command CLI option into a comma-separated string configuration
    
    It attempts to follow POSIX conventions, so that it's possible to execute:
    
        $ kamel run -t <trait>.<property>=<value_1> ... -t <trait>.<property>=<value_N>
    
    Or:
    
        $ kamel run --trait <trait>.<property>=<value_1>,...,<value_N>
---
 pkg/cmd/run.go | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go
index 9c83fda..9f3126e 100644
--- a/pkg/cmd/run.go
+++ b/pkg/cmd/run.go
@@ -471,7 +471,17 @@ func (*runCmdOptions) configureTrait(integration *v1alpha1.Integration, config s
 		}
 	}
 
-	spec.Configuration[prop] = val
+	if len(spec.Configuration[prop]) > 0 {
+		// Aggregate multiple occurences of the same option into a comma-separated string,
+		// attempting to follow POSIX conventions.
+		// This enables to execute:
+		// $ kamel run -t <trait>.<property>=<value_1> ... -t <trait>.<property>=<value_N>
+		// Or:
+		// $ kamel run --trait <trait>.<property>=<value_1>,...,<value_N>
+		spec.Configuration[prop] = spec.Configuration[prop] + "," + val
+	} else {
+		spec.Configuration[prop] = val
+	}
 	integration.Spec.Traits[traitID] = spec
 	return nil
 }