Skip to content

Commit

Permalink
Fail gracefulliy if no .nu files changed
Browse files Browse the repository at this point in the history
  • Loading branch information
texastoland committed Mar 14, 2024
1 parent 21f0780 commit 50494e8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions toolkit.nu
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ def "with files" [
[_ true] => (glob **/*.nu --exclude [before_v0.60/**])
[null _] => (git diff --name-only origin/main | lines)
[$files _] => $files
} | where $it ends-with .nu and ($it | path exists)
let error_count = if ($files | length) == 0 {
print 'warning: no .nu files found!'
0
} else {
$files
| each { path expand }
| do $task $files # run the closure with both input and param
| math sum # it MUST return a non-empty list of ints
}
let error_count = $files
| where $it ends-with .nu and ($it | path exists)
| each { path expand }
| do $task $files # run the closure with both input and param
| math sum # it MUST return a non-empty list of ints
if $and_exit {
exit $error_count
} else {
Expand Down

0 comments on commit 50494e8

Please sign in to comment.