Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/909#discussion_r39963536
  
    --- Diff: usage/cli/src/main/java/org/apache/brooklyn/cli/AbstractMain.java 
---
    @@ -150,6 +153,34 @@ public ToStringHelper string() {
                         .add("arguments", arguments);
             }
         }
    +    
    +    /** superclass which reads `-D` system property definitions and 
applies them
    +     * <p>
    +     * useful when scripting, e.g. where brooklyn.sh encodes `java 
o.a.b.Main "$@"` 
    +     * but we want the caller to be able to pass system properties
    +     */
    +    public static abstract class BrooklynCommandWithSystemDefines extends 
BrooklynCommandCollectingArgs {
    +        @Option(type = OptionType.GLOBAL, name = { "-D" }, description = 
"Set java system property")
    +        public List<String> defines1;
    +
    +        @Option(name = { "-D" }, description = "Set java system property")
    +        public List<String> defines2;
    +
    +        public List<String> getDefines() { return 
MutableList.copyOf(defines1).appendAll(defines2); }
    +        public Map<String,String> getDefinesAsMap() { return 
KeyValueParser.parseMap(Strings.join(getDefines(),",")); }
    --- End diff --
    
    Feels like it would be good to have a 
`KeyValueParser.parseMapEntries(List<String>)`, rather than us having to join 
them so they can be split apart again (which might lead to problems if a value 
contained a comma, and was not being quoted here).
    
    But this is good enough for now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to