3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-20 02:49:49 +01:00

FuncCommand: improve usage and help messages

This commit is contained in:
Pragmatic Software 2019-09-02 10:36:34 -07:00
parent 41d83d1b9b
commit fcd3b6e64d

View File

@ -86,7 +86,7 @@ sub do_func {
my $func = $self->{pbot}->{interpreter}->shift_arg($stuff->{arglist}); my $func = $self->{pbot}->{interpreter}->shift_arg($stuff->{arglist});
if (not defined $func) { if (not defined $func) {
return "Usage: func <keyword> [arguments]"; return "Usage: func <keyword> [arguments]; see also: func help";
} }
if (not exists $self->{funcs}->{$func}) { if (not exists $self->{funcs}->{$func}) {
@ -106,6 +106,10 @@ sub do_func {
sub func_help { sub func_help {
my ($self, $func) = @_; my ($self, $func) = @_;
if (not length $func) {
return "func: invoke built-in functions; usage: func <keyword> [arguments]; to list available functions: func list";
}
if (not exists $self->{funcs}->{$func}) { if (not exists $self->{funcs}->{$func}) {
return "No such func '$func'."; return "No such func '$func'.";
} }