From: freku045@student.liu.se Date: Sat, 10 Dec 2005 19:37:59 GMT Subject: [PATCH 21/25] git-send-email: Usage message clean-up. Message-ID: <11342434792231-git-send-email-freku045@student.liu.se> In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se> Signed-off-by: Fredrik Kuivinen --- git-send-email.perl | 62 ++++++++++++++++++++++++++++----------------------- 1 files changed, 34 insertions(+), 28 deletions(-) 38fde073a59d00a19111a30e8f804c4e784835e7 diff --git a/git-send-email.perl b/git-send-email.perl index ec1428d..5f6b729 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -27,6 +27,38 @@ use Email::Valid; sub unique_email_list(@); sub cleanup_compose_files(); +sub usage { + print < [... file | directory ] +Options: + --from Specify the "From:" line of the email to be sent. + + --to Specify the primary "To:" line of the email. + + --compose Use \$EDITOR to edit an introductory message for the + patch series. + + --subject Specify the initial "Subject:" line. + Only necessary if --compose is also set. If --compose + is not set, this will be prompted for. + + --in-reply-to Specify the first "In-Reply-To:" header line. + Only used if --compose is also set. If --compose is not + set, this will be prompted for. + + --chain-reply-to If set, the replies will all be to the previous + email sent, rather than to the first email sent. + Defaults to on. + + --smtp-server If set, specifies the outgoing SMTP server to use. + Defaults to localhost. +EOT + + print $_[0], "\n" if defined $_[0]; + + exit(1); +} + # Constants (essentially) my $compose_filename = ".msg.$$"; @@ -51,6 +83,7 @@ my $rc = GetOptions("from=s" => \$from, "chain-reply-to!" => \$chain_reply_to, "smtp-server=s" => \$smtp_server, "compose" => \$compose, + "help|h" => sub { usage; }, ); # Now, let's fill any that aren't set in with defaults: @@ -187,34 +220,7 @@ for my $f (@ARGV) { if (@files) { print $_,"\n" for @files; } else { - print < [... file | directory ] -Options: - --from Specify the "From:" line of the email to be sent. - - --to Specify the primary "To:" line of the email. - - --compose Use \$EDITOR to edit an introductory message for the - patch series. - - --subject Specify the initial "Subject:" line. - Only necessary if --compose is also set. If --compose - is not set, this will be prompted for. - - --in-reply-to Specify the first "In-Reply-To:" header line. - Only used if --compose is also set. If --compose is not - set, this will be prompted for. - - --chain-reply-to If set, the replies will all be to the previous - email sent, rather than to the first email sent. - Defaults to on. - - --smtp-server If set, specifies the outgoing SMTP server to use. - Defaults to localhost. - -Error: Please specify a file or a directory on the command line. -EOT - exit(1); + usage "Error: Please specify a file or a directory on the command line."; } # Variables we set as part of the loop over files -- 0.99.9.GIT