Skip to content

Instantly share code, notes, and snippets.

@chriskuech
Created June 13, 2019 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriskuech/6606d89e2ea03e80ea0e9ffa523eebb7 to your computer and use it in GitHub Desktop.
Save chriskuech/6606d89e2ea03e80ea0e9ffa523eebb7 to your computer and use it in GitHub Desktop.
... # previous param definition
& {
... # previous class and enum definitions
foreach ($file in $files) {
$lines = Get-Content $file
foreach ($i in 1..$lines.Count) {
if ($lines[$i] -match "TODO: \(([^)]+)\) (.*)$") {
# parse prioritized ToDo
[ToDo]@{
FilePath = $file
Priority = $Matches[1]
Line = $i + 1
Task = $Matches[2]
}
} elseif ($lines[$i] -match "TODO: (.*)$") {
# parse unprioritized ToDo
[ToDo]@{
FilePath = $file
Priority = $null
Line = $i + 1 # line numbers are 1-indexed
Task = $Matches[1]
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment