aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-07 00:35:57 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-07 00:35:57 -0400
commit2bc948567e51e2c79cc703968e59c4caccb4b176 (patch)
treef5fd2d6a738a5c32ad7b5e8db616c90d8255ff41
parent11487cd835e4a0de70eb033d3e2a003844aa9052 (diff)
Check for empty files
-rw-r--r--examples/tomodeps.tm9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/tomodeps.tm b/examples/tomodeps.tm
index e7066a5a..34216806 100644
--- a/examples/tomodeps.tm
+++ b/examples/tomodeps.tm
@@ -126,7 +126,14 @@ func draw_tree(file:Text, dependencies:{Text:{Text}}):
_draw_tree(child, dependencies, already_printed=&printed, is_last=is_child_last)
func main(files:[Text]):
- for f,file in files:
+ if files.length == 0:
+ say("
+ Please provide at least one file!
+ $_USAGE
+ ")
+ return
+
+ for file in files:
if not file:matches($/{..}.tm/):
say("$\x1b[2mSkipping $file$\x1b[m")
skip