On Fri, Aug 25, 2017 at 12:59 PM, red 888 <[email protected]> wrote:
> I have this in my shared library in /vars/myLib.groovy:
>
> def call(Map args) {
>
>     one = args.one
>     two = args.two
>     three = args.three
>
>     somePlugin(
>         someParam: one,
>         otherParam: two,
>         anotherParam: three
>     )
>
> }
>
> Then in my jenkinsfile I call it like this:
> myLib(
>     one: 'sdfsdf',
>     two: 'ldskfjsdjf',
>     three: 'snfeknfsi'
> )
>
> This works great, but I was wondering if there is a better way to get named
> parameters or maybe there is a feature of the DSL I could leverage for
> something like this?

You can simplify it somewhat by removing the intermediate variables:

def call(Map args) {
    somePlugin(
        someParam: args.one,
        otherParam: args.two,
        anotherParam: args.three
    )
}

>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/3292a5e4-6ac9-4876-8da1-3dbd963bb9a3%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAA5t8Vp5Q5-Od4HvHXUfqeqNdBmOP%3Dx3y17WJvy8Qe1DWFheXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to