File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ Set-StrictMode - Version Latest
2+
3+ function Remove-LeadingComment {
4+ param ([string []]$lines )
5+
6+ $index = 0
7+ while ($index -lt $lines.Count ) {
8+ if (! $lines [$index ].StartsWith(" #" )) {
9+ break
10+ }
11+ $index ++
12+ }
13+ if ($index -lt $lines.Count ) {
14+ $lines [$index .. ($lines.Count - 1 )]
15+ }
16+ }
17+
18+ function Get-MergedScript {
19+ param ([string ]$Path )
20+
21+ try {
22+ $Path = Resolve-Path $Path
23+
24+ $c = Get-Content - Path " $Path \NtObjectManager.psm1" | Out-String
25+ $i = $c.IndexOf (" # Source the external scripts into this module." )
26+
27+ $res = $c.Substring (0 , $i )
28+ $fs = ls " $Path \*.ps1"
29+ foreach ($f in $fs ) {
30+ $c = Get-Content - Path $f.FullName
31+ $c = Remove-LeadingComment $c | Out-String
32+ $res += $c
33+ }
34+ $res
35+ } catch {
36+ Write-Error $_
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments