forked from szymonos/linux-setup-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts_egsave.ps1
More file actions
40 lines (34 loc) · 816 Bytes
/
scripts_egsave.ps1
File metadata and controls
40 lines (34 loc) · 816 Bytes
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
#Requires -PSEdition Core
#!/usr/bin/pwsh -nop
<#
.SYNOPSIS
Generate example scripts from the current repository.
.EXAMPLE
./scripts_egsave.ps1
#>
begin {
$ErrorActionPreference = 'Stop'
# set location to workspace folder
Push-Location $PSScriptRoot
# check if the Invoke-ExampleScriptSave function is available, otherwise clone ps-modules repo
try {
Get-Command Invoke-ExampleScriptSave -CommandType Function | Out-Null
} catch {
Import-Module (Resolve-Path './modules/SetupUtils')
}
}
process {
# save example scripts
$folders = @(
'wsl'
'.assets/provision'
'.assets/scripts'
'.assets/tools'
)
foreach ($folder in $folders) {
Invoke-ExampleScriptSave $folder -FolderFromBase
}
}
end {
Pop-Location
}