Pipe 'help' through a pager.
This commit is contained in:
parent
997917ae82
commit
1b744e421d
1 changed files with 16 additions and 0 deletions
16
plugins/help
16
plugins/help
|
@ -13,6 +13,19 @@ sub command :Tab(help,wtf,omgwtfbbq) {
|
||||||
|
|
||||||
return NEXT if $command !~ /^(?:help|wtf|omgwtfbbq)$/;
|
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}";
|
say "\n${bold}Valid commands:${off}";
|
||||||
|
|
||||||
my $width = max(map length s/[<>]//rg, keys %::HELP);
|
my $width = max(map length s/[<>]//rg, keys %::HELP);
|
||||||
|
@ -38,5 +51,8 @@ ${bold}Advanced usage:${off} pass space separated arguments to parameters
|
||||||
Complete each transaction with ${underline}account${off} (i.e. enter your name).
|
Complete each transaction with ${underline}account${off} (i.e. enter your name).
|
||||||
END
|
END
|
||||||
|
|
||||||
|
select STDOUT;
|
||||||
|
close $pipe;
|
||||||
|
|
||||||
return ACCEPT;
|
return ACCEPT;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue