Skip to content

Commit 32499c4

Browse files
committed
Simplify display-notices implementation
1 parent ea9ac33 commit 32499c4

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

make_release/release-note/notes.nu

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -140,29 +140,15 @@ def add-notice [type: string, message: string]: record -> record {
140140

141141
# Print all of the notices associated with a PR
142142
def display-notices []: table -> nothing {
143-
# Create row with PR info for each notice
144-
| each {|pr|
145-
get notices | each {|e|
146-
$pr | insert type $e.type | insert message $e.message
147-
}
148-
}
149-
| flatten
150-
| group-by --to-table type
151-
| sort-by -r type
152-
| each {|e| $e.items | display-notice-type $e.type }
153-
| ignore
154-
}
155-
156-
# Print notices of a certain type
157-
def display-notice-type [type: string]: table -> nothing {
158143
let prs = $in
159144
let colors = {error: (ansi red), warning: (ansi yellow)}
160-
let color = $colors | get $type
161145

162146
$prs
163-
| group-by message --to-table
164-
| sort-by message
147+
| flatten -a notices
148+
| group-by --to-table type message
149+
| sort-by -r type
165150
| each {|e|
151+
let color = $colors | get $e.type
166152
print $"($color)PRs with ($e.message):"
167153
$e.items | each { format-pr | print $"- ($in)" }
168154
print ""

0 commit comments

Comments
 (0)