forked from iricigor/InstallModuleFromGit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InstallModuleFromGit.psm1
40 lines (27 loc) · 1.06 KB
/
InstallModuleFromGit.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost','')]
param()
$ModName = 'InstallModuleFromGit'
Get-Module $ModName | Remove-Module -Force
Write-Host "`n`n$ModName module import starting`n" -ForegroundColor Cyan
#
# Module definitions
#
#
# Import main functions
#
$Public = @(Get-ChildItem (Join-Path $PSScriptRoot 'Public') -Filter *.ps1)
$Private = @(Get-ChildItem (Join-Path $PSScriptRoot 'Private') -Filter *.ps1 -ErrorAction SilentlyContinue)
foreach ($F in ($Private+$Public) ) {
Write-Host ("Importing $($F.Name)... ") -NoNewline
try {
. ($F.FullName)
Write-Host ' OK ' -ForegroundColor Green
} catch {
Write-Host 'FAILED' -ForegroundColor Red
}
}
Export-ModuleMember -Function $Public.BaseName
Write-Host "Exported $($Public.Count) member(s)"
Export-ModuleMember -Alias *
Write-Host "`nType 'Get-Command -Module $ModName' for list of commands, 'Get-Help <CommandName>' for help, or"
Write-Host "'Get-Command -Module $ModName | Get-Help | Select Name, Synopsis' for explanation on all commands`n"