From 7ce25f1ec9112448b1354392c73901b7145feb09 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Tue, 2 Mar 2021 15:07:07 -0700 Subject: [PATCH] Markdown.pl: format -h output properly Make the usage output use the correct termcap codes to look nice if they're available. Signed-off-by: Kyle J. McKay --- Markdown.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Markdown.pl b/Markdown.pl index ca39c66..633c710 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -313,6 +313,12 @@ BEGIN {%_yamlvis = ( strip => 0 )} +sub _require_pod_usage() { + require Pod::Usage; + eval 'require Pod::Text::Termcap; 1;' and + @Pod::Usage::ISA = (qw( Pod::Text::Termcap )); +} + #### BBEdit/command-line text filter interface ########################## sub _main { local *ARGV = \@_; @@ -326,10 +332,10 @@ sub _main { Getopt::Long::Configure(qw(bundling require_order pass_through)); GetOptions( 'help' => sub { - require Pod::Usage; + _require_pod_usage; Pod::Usage::pod2usage(-verbose => 2, -exitval => 0)}, 'h' => sub { - require Pod::Usage; + _require_pod_usage; Pod::Usage::pod2usage(-verbose => 0, -exitval => 0)}, 'version|V' => sub { # Version info print "\nThis is Markdown, version $VERSION.\n", $COPYRIGHT;