Skip to content

Instantly share code, notes, and snippets.

@RafPe
Created August 12, 2015 20:47
Show Gist options
  • Save RafPe/1ab94a798407836fea84 to your computer and use it in GitHub Desktop.
Save RafPe/1ab94a798407836fea84 to your computer and use it in GitHub Desktop.
function Get-RemoteRequiredFunctions
{
<#
.SYNOPSIS
Gets required functions
.PARAMETER functionName
this is object type data coming via pipeline
.DESCRIPTION
This cmdlet compares generic property names and values and return data if they match parameters passed.
Be aware that it lowers the characters for being compliant with all remaining functions
.EXAMPLE
Get-RemoteRequiredFunctions -functionName Do-SomethingAwesomeFunc
.FUNCTIONALITY
RequiredFunction<Export-FunctionRemote>
#>
param
(
[string]$functionName
)
try
{
# create array to hold our processed results
$arrOfRes = @()
$requiredRemoteFunctions=Get-Help $functionName
if($requiredRemoteFunctions.Functionality.Contains(';'))
{
$requiredRemoteFunctions = $requiredRemoteFunctions.Functionality.Split(';').Trim()
$requiredRemoteFunctions | % { if($_ -match 'RequiredFunction<(?<function>.*?)\>')
{
$funcBody = Export-EolFunctionRemote $matches.function
$arrOfRes=$arrOfRes + $funcBody
}
}
return $arrOfRes
}
}
catch
{
return $null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment