Groovy web console

subscribe to the feed Subscribe
to this
site

A function with a param that expects a list of maps

Published 2 months ago by FreeBDSM with tags function list of maps
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def call(String nodeLabel, String filePath, Map replacements) {
    node(nodeLabel) {
        println("Replacing strings in file: '" + filePath + "'")
        replacements.each{
             it.each{needle, replacement -> println("Replacing '" + needle + "' with '" + replacement + "'")}
        }
    }
}

call(
    'linux',
    '/tmp/bullshit/',
    [
        {
            needle: 'tits',
            replacement: 'tats',
        },
        {
            needle: 'beeps',
            replacement: 'boops',
        },
    ]
)
 
return