Skip to content

Instantly share code, notes, and snippets.

@aadennis
Created September 27, 2020 15:45
Show Gist options
  • Save aadennis/68922d538ebfc64fe747e5fb43bd6432 to your computer and use it in GitHub Desktop.
Save aadennis/68922d538ebfc64fe747e5fb43bd6432 to your computer and use it in GitHub Desktop.
dependency for DockerUtilities.ps1
<#
Get the name of each function in the given PowerShell Script.
Assumptions:
1. the line starts with "function".
2. A line starting with "function" is not embedded in a comment block.
There is no error handling.
#>
function Get-FunctionsInScript($script) {
Get-Content $script | ForEach-Object {
$currentLine = $_
if ($currentLine.startswith("function")) {
$functionList += "$currentLine`r`n"
}
}
$functionList
}
Function Get-FullHistory() {
$historyFile = (Get-PSReadlineOption).HistorySavePath
Write-Host "path = [$historyFile]"
Get-Content $historyFile | sort | Get-Unique > c:/temp/PsHistory.txt
$hash = @{}
gc $historyFile | % {if ($hash.$_ -eq $null) { $_}; $hash.$_ = 1} > c:/temp/PsHistory2.txt
}
#Get-FullHistory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment