mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 20:42:38 +01:00
Show supported languages when invalid language given
This commit is contained in:
parent
b3081b9e9f
commit
ac8dadb7f7
@ -3,6 +3,8 @@
|
|||||||
use warnings;
|
use warnings;
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
use File::Basename;
|
||||||
|
|
||||||
my $language = shift @ARGV // 'c11';
|
my $language = shift @ARGV // 'c11';
|
||||||
$language = lc $language;
|
$language = lc $language;
|
||||||
|
|
||||||
@ -11,7 +13,20 @@ eval {
|
|||||||
require "$language.pm";
|
require "$language.pm";
|
||||||
} or do {
|
} or do {
|
||||||
print "Language '$language' is not supported.\n";
|
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);
|
my $nick = shift @ARGV // (print "Missing nick argument.\n" and die);
|
||||||
|
Loading…
Reference in New Issue
Block a user