Skip to content

Commit

Permalink
Aggregate multiple occurences of the same run command CLI option into…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
astefanutti authored and nicolaferraro committed Jan 29, 2019
1 parent c07b579 commit f3044c7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit f3044c7

Please sign in to comment.