Skip to content

Commit

Permalink
Early return for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
sholderbach committed Dec 22, 2024
1 parent e414edb commit e3b3496
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions make_release/release-note/notes.nu
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,22 @@ export def write-toc [file: path] {
get line | split chars | take while { $in == '#' } | length
}
| insert nocomment {
if ($in.level == 1) {
let line = $in.line

# Try to use the whitelist first
if ($known_h1s | any {|| $line =~ $in}) {
return true
}
let user = ([Ignore Accept] |
input list $"Is this a code comment or a markdown h1 heading:(char nl)(ansi blue)($line)(ansi reset)(char nl)Choose if we include it in the TOC!")
match $user {
"Accept" => {true}
"Ignore" => {false}
}
if ($in.level != 1) {
return true
}
let line = $in.line

} else {
# Try to use the whitelist first
if ($known_h1s | any {|| $line =~ $in}) {
return true
}
let user = ([Ignore Accept] |
input list $"Is this a code comment or a markdown h1 heading:(char nl)(ansi blue)($line)(ansi reset)(char nl)Choose if we include it in the TOC!")
match $user {
"Accept" => {true}
"Ignore" => {false}
}

}
)

Expand Down

0 comments on commit e3b3496

Please sign in to comment.