
The signatures feature has been "experimental" since Perl 5.20 (May 2014), but expected to stay. After 8 years I'm ready to take the risk :) Have added Perl v5.28 (June 2018) as the minimum requirement, even though the current revbank should work with 5.20, to see if this bothers any users. Perl v5.28 is in Debian "buster", which is now oldstable.
56 lines
1.7 KiB
Perl
56 lines
1.7 KiB
Perl
#!perl
|
|
|
|
HELP "help" => "The stuff you're looking at right now :)";
|
|
|
|
use List::Util qw(max);
|
|
|
|
my $bold = "\e[1m";
|
|
my $underline = "\e[4m";
|
|
my $off = "\e[0m";
|
|
|
|
sub command :Tab(help,wtf,omgwtfbbq) ($self, $cart, $command, @) {
|
|
return NEXT if $command !~ /^(?:help|wtf|omgwtfbbq)$/;
|
|
|
|
# GNU less(1) and more(1) are a bad choice to present to total newbies who
|
|
# might have no interest in learning to use these surprisingly powerful
|
|
# tools, so I will not accepting patches to use either of those, or to use
|
|
# the PAGER environment variable (because that will typically be set to
|
|
# either one of those by default). For example, typing "v" will excute
|
|
# vi...
|
|
# On the other hand, busybox(1) has a "more" applet that gives the user
|
|
# clear instructions and seems mostly harmless too.
|
|
my $pipe;
|
|
if (open $pipe, "|-", "busybox", "more") {
|
|
select $pipe;
|
|
}
|
|
|
|
say "\n${bold}Valid commands:${off}";
|
|
|
|
my $width = max(map length s/[<>]//rg, keys %::HELP);
|
|
|
|
for my $command (sort keys %::HELP) {
|
|
my $display = $command;
|
|
|
|
my $length = length $display =~ s/[<>]//rg;
|
|
|
|
$display =~ s/</$underline/g;
|
|
$display =~ s/>/$off/g;
|
|
|
|
# Because of markup codes, a simple %-42s doesn't work.
|
|
$display .= " " x ($width - $length);
|
|
|
|
say sprintf " %s %s", $display, $::HELP{$command};
|
|
}
|
|
|
|
print <<"END";
|
|
|
|
${bold}Simple usage: ${off} press <Enter> after a command for follow-up prompts
|
|
${bold}Advanced usage:${off} pass space separated arguments to parameters
|
|
Complete each transaction with ${underline}account${off} (i.e. enter your name).
|
|
END
|
|
|
|
select STDOUT;
|
|
close $pipe;
|
|
|
|
return ACCEPT;
|
|
}
|