We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 698f580 commit 3094378Copy full SHA for 3094378
1 file changed
merge_script.ps1
@@ -0,0 +1,38 @@
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
0 commit comments