From 50494e892cb4ed82a13e8a9b638dfc2be15e5a87 Mon Sep 17 00:00:00 2001 From: Texas Toland Date: Wed, 13 Mar 2024 22:25:48 -0500 Subject: [PATCH] Fail gracefulliy if no .nu files changed --- toolkit.nu | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/toolkit.nu b/toolkit.nu index 79f3b694a..37392a41b 100644 --- a/toolkit.nu +++ b/toolkit.nu @@ -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 {