From 2bc948567e51e2c79cc703968e59c4caccb4b176 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 7 Sep 2024 00:35:57 -0400 Subject: Check for empty files --- examples/tomodeps.tm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'examples') 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 -- cgit v1.2.3