From ac8dadb7f7e1f25e84b3bd0a8563f02ecc9955f6 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Thu, 15 Jan 2015 21:20:34 -0800 Subject: [PATCH] Show supported languages when invalid language given --- modules/compiler_vm/compiler_vm_client.pl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/compiler_vm/compiler_vm_client.pl b/modules/compiler_vm/compiler_vm_client.pl index 48fc09a0..e657cc85 100755 --- a/modules/compiler_vm/compiler_vm_client.pl +++ b/modules/compiler_vm/compiler_vm_client.pl @@ -3,6 +3,8 @@ use warnings; use strict; +use File::Basename; + my $language = shift @ARGV // 'c11'; $language = lc $language; @@ -11,7 +13,20 @@ eval { require "$language.pm"; } or do { print "Language '$language' is not supported.\n"; - die $@; + + my @languages = glob 'languages/*.pm'; + my $comma = ''; + print "Supported languages are: "; + foreach my $lang (sort @languages) { + $lang = basename($lang); + next if $lang =~ m/^_/; + $lang =~ s/\.pm$//; + print "$comma$lang"; + $comma = ', '; + } + print "\n"; + + exit; }; my $nick = shift @ARGV // (print "Missing nick argument.\n" and die);