Private/Invoke-EdenCommandCodeFlow.ps1
function Invoke-EdenCommandCodeFlow { <# .SYNOPSIS Runs code flow for calling local script. .DESCRIPTION Calls the code creation script provided and prints messages around executing the script. #> [CmdletBinding()] param( # The local script to call. Relative path from the Eden folder. [Parameter(Mandatory=$True)] [String] $LocalCommandPath, # The name of the local or global settins file to pass to the Eden script. [Alias("n")] [String] $Name, [Alias("svn")] [String] $ServiceName, [Alias("sln")] [String] $SolutionName, [Parameter()] [String] $SettingsName, # The string to display at the end of the logging prefix for the command group. [Parameter(Mandatory=$True)] [String] $CommandGroup, # The message to display as starting, finished, or errored around invoking the command. [Parameter(Mandatory=$True)] [String] $Message, # Passes a hash table to the local command script for custom arguments that it needs. # This set of parameters should be option. The script should prompt the user for the # values if they are not provided. This helps with discovery of the customer parameters. [Parameter(Mandatory=$False)] [Hashtable] $AdditionalArguments ) $location = Get-Location try { $settings = Get-EdenSettings -Name $SettingsName $loggingPrefix = "$($settings.SolutionName) $($settings.ServiceName) $($settings.Name) $($CommandGroup)" if (!$ServiceName) { $ServiceName = $settings.ServiceName } if (!$SolutionName) { $SolutionName = $settings.SolutionName } $Name = "$($Name)Function" Write-EdenInfo "Starting: $Message '$SolutionName.$ServiceName.$Name'" $AdditionalArguments.Name = $Name $AdditionalArguments.ServiceName = $ServiceName $AdditionalArguments.SolutionName = $SolutionName Invoke-EdenLocalCommand $LocalCommandPath $null $loggingPrefix $AdditionalArguments Write-EdenInfo "Finished: $Message '$SolutionName.$ServiceName.$Name'" } catch { Write-EdenError "Error: $Message Message: '$($_.Exception.Message)'" throw } finally { Set-Location $location } } |