Skip to content
This repository

I'm trying to write a custom Task, but variables in my scriptblock aren't in the correct scope. #36

Closed
AnthonyMastrean opened this Issue · 1 comment

1 participant

Anthony Mastrean
Anthony Mastrean

I'm trying to write a declarative custom task. Normally, your tasks look like this

Task echo {
    Write-Host "hello, this is my task"
}

But, if you want to be declarative and separate the declaration and execution of the task, you'll want something like this

Echo-Task hello { param($x)
    $x.message = "hello, this is my task"
}

Yeah, it's a little verbose for this trivial example, but it's powerful for more complicated tasks. And it's what's happening over in the [Albacore library]al.

Anthony Mastrean

oops, this one was created by accident

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.