From 78f4fa77035d3fe15e1b55083c09eb65fd8e1d92 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Thu, 3 Sep 2015 00:43:08 -0700 Subject: [PATCH] Markdown.pl: add support for --help Signed-off-by: Kyle J. McKay --- Markdown.pl | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Markdown.pl b/Markdown.pl index 6d238a3..8cf2418 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -192,14 +192,19 @@ else { use Getopt::Long; Getopt::Long::Configure('pass_through'); GetOptions(\%cli_opts, + 'h', + 'help', 'version', 'shortversion', 'html4tags', ); + if ($cli_opts{'help'} || $cli_opts{'h'}) { + exec 'perldoc', $0; + } if ($cli_opts{'version'}) { # Version info print "\nThis is Markdown, version $VERSION.\n"; - print "Copyright 2004 John Gruber\n"; - print "http://daringfireball.net/projects/markdown/\n\n"; + print "Copyright (C) 2004 John Gruber\n"; + print "Copyright (C) 2015 Kyle J. McKay\n"; exit 0; } if ($cli_opts{'shortversion'}) { # Just the version number string. @@ -1330,7 +1335,7 @@ B =head1 SYNOPSIS -B [ B<--html4tags> ] [ B<--version> ] [ B<-shortversion> ] +B [ B<--html4tags> ] [ B<--version> ] [ B<--shortversion> ] [ B<--help> ] [ I ... ] @@ -1381,6 +1386,11 @@ Display Markdown's version number and copyright information. Display the short-form version number. +=item B<-h>, B<--help> + +Display Markdown's help. + + =back @@ -1405,18 +1415,23 @@ See the readme file for detailed release notes for this version. 1.0 - 28 Aug 2004 -=head1 AUTHOR +=head1 AUTHORS John Gruber http://daringfireball.net + http://daringfireball.net/projects/markdown/ PHP port and other contributions by Michel Fortin http://michelf.com + Additional enhancements and tweaks by Kyle J. McKay + mackylegmail.com + =head1 COPYRIGHT AND LICENSE -Copyright (c) 2003-2004 John Gruber +Copyright (C) 2003-2004 John Gruber +Copyright (C) 2015 Kyle J. McKay All rights reserved.