Is it possible to implement a task-style system in PowerShell so that you could do the following:
.\script.ps1 build # runs build() function
.\script.ps1 publish # runs publish() function
I was hoping to use PowerShell for building/publishing an application rather than requiring the user to install gradle/msbuild and wanted to avoid needing to update a switch statement for every function added.
Currently it is messy like this:
#!/usr/bin/env powershell
param(
$action = 'build'
)
function build() {
echo 'build';
}
function publish() {
echo 'publish';
}
switch($action) {
'build' { build; }
'publish' { publish; }
}