You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tools/ImportExamples.ps1
+14-1Lines changed: 14 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -268,12 +268,14 @@ function Update-ExampleFile {
268
268
$SearchTextForNewImports="{{ Add description here }}"
269
269
$ReplaceEverything=$False
270
270
if ($HeaderList.Count-eq0) {
271
+
Write-Host"The header list is empty. Please check the external docs url."
271
272
for ($d=0; $d-lt$ExampleList.Count; $d++) {
272
273
$sum=$d+1
273
274
$HL=$HeaderList.Add("### Example "+$sum+": Code snippet".Trim())
274
275
}
275
276
}
276
277
if ($HeaderList.Count-ne$ExampleList.Count) {
278
+
Write-Host"The number of examples and the number of headers are not equal. Please check the external docs url."
277
279
$HeaderList.Clear()
278
280
for ($d=0; $d-lt$ExampleList.Count; $d++) {
279
281
$sum=$d+1
@@ -286,6 +288,14 @@ function Update-ExampleFile {
286
288
}
287
289
$HeadCount=$HeaderList.Count
288
290
$ExampleCount=$ExampleList.Count
291
+
#On the example list check the one that contains the command pattern and if doesn't match remove it from the list. Also remove the header from the header list
292
+
for ($x=0; $x-lt$HeaderList.Count; $x++) {
293
+
if ($ExampleList[$x] -notmatch"\b$CommandPattern\b") {
294
+
$ExampleList.RemoveAt($x)
295
+
$HeaderList.RemoveAt($x)
296
+
}
297
+
}
298
+
289
299
$WrongExamplesCount=0;
290
300
$SkippedExample=-1
291
301
$TotalText=""
@@ -298,9 +308,12 @@ function Update-ExampleFile {
0 commit comments