Audio-Nama
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Audio/Nama/Help.pm view on Meta::CPAN
# -------------------- Help ----------------------
package Audio::Nama;
use Modern::Perl '2020';
{
no warnings 'uninitialized';
sub helpline {
my $cmd = shift;
my $out = "Command: $cmd\n";
$out .= "Shortcuts: $text->{commands}->{$cmd}->{short}\n"
if $text->{commands}->{$cmd}->{short};
$out .= "Category: $text->{commands}->{$cmd}->{type}\n";
my $what = munge_help($text->{commands}->{$cmd}->{what});
$out .= "Description: $what";
$out .= "Usage: $cmd ";
if ( $text->{commands}->{$cmd}->{parameters}
&& $text->{commands}->{$cmd}->{parameters} ne 'none' ){
$out .= $text->{commands}->{$cmd}->{parameters}
}
$out .= "\n";
my $example = $text->{commands}->{$cmd}->{example};
$example = munge_help($example);
#$example =~ s/!n/\n/g;
if ($example){
$out .= "Example: ";
if ($example =~ /\n/s){
$example = "\n$example"; # add leading newline
$example =~ s(\n)(\n )g; # indent
}
$out .= $example;
$out .= "\n";
}
($/, ucfirst $out, $/);
}
sub munge_help {
my $text = shift;
$text =~ s/(^\s*)!(\s*#)/$1 $2/mg;
$text =~ s/(^\s*!)/#/mg;
$text
}
}
sub helptopic {
my $i = shift;
my $key = $help->{index}->{$i};
format_help_topic($i, $key);
}
sub format_help_topic {
my ($index, $key) = @_;
my $title = $help->{display}->[$index];
my @output;
push @output, "\n-- $help->{title}->[$index] --\n\n";
push @output, $help->{topic}->{$key}, $/;
@output
}
sub help {
my $name = shift;
$name =~ s/-/_/g; # help indices require underscores
chomp $name;
#print "seeking help for argument: $name\n";
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.494 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )