From: Frank Lichtenheld <frank@lichtenheld.de>
To: git@vger.kernel.org
Cc: Junio C Hamano <junkio@cox.net>,
Frank Lichtenheld <frank@lichtenheld.de>
Subject: [PATCH 3/5] cvsimport: Improve usage error reporting
Date: Fri, 6 Apr 2007 23:52:41 +0200 [thread overview]
Message-ID: <11758963642149-git-send-email-frank@lichtenheld.de> (raw)
In-Reply-To: <11758963643049-git-send-email-frank@lichtenheld.de>
Actually tell the user what he did wrong in case of usage errors
instead of only printing the general usage information.
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
---
git-cvsimport.perl | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index d3fbcbc..ac74bc5 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -32,7 +32,9 @@ $ENV{'TZ'}="UTC";
our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,$opt_M,$opt_A,$opt_S,$opt_L, $opt_a);
my (%conv_author_name, %conv_author_email);
-sub usage() {
+sub usage(;$) {
+ my $msg = shift;
+ print(STDERR "Error: $msg\n") if $msg;
print STDERR <<END;
Usage: ${\basename $0} # fetch/update GIT from CVS
[-o branch-for-HEAD] [-h] [-v] [-d CVSROOT] [-A author-conv-file]
@@ -117,7 +119,7 @@ read_repo_config($opts);
getopts($opts) or usage();
usage if $opt_h;
-@ARGV <= 1 or usage();
+@ARGV <= 1 or usage("You can't specify more than one CVS module");
if ($opt_d) {
$ENV{"CVSROOT"} = $opt_d;
@@ -130,7 +132,7 @@ if ($opt_d) {
} elsif ($ENV{"CVSROOT"}) {
$opt_d = $ENV{"CVSROOT"};
} else {
- die "CVSROOT needs to be set";
+ usage("CVSROOT needs to be set");
}
$opt_o ||= "origin";
$opt_s ||= "-";
@@ -149,7 +151,7 @@ if ($#ARGV == 0) {
chomp $cvs_tree;
close $f;
} else {
- usage();
+ usage("CVS module has to be specified");
}
our @mergerx = ();
--
1.5.1
next prev parent reply other threads:[~2007-04-06 21:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-06 21:52 [PATCH 0/5] cvsimport: Improve documentation Frank Lichtenheld
2007-04-06 21:52 ` [PATCH 1/5] cvsimport: sync usage lines with existing options Frank Lichtenheld
2007-04-06 21:52 ` [PATCH 2/5] cvsimport: Improve documentation of CVSROOT and CVS module determination Frank Lichtenheld
2007-04-06 21:52 ` Frank Lichtenheld [this message]
2007-04-06 21:52 ` [PATCH 4/5] cvsimport: Reorder options in documentation for better understanding Frank Lichtenheld
2007-04-06 21:52 ` [PATCH 5/5] cvsimport: Improve formating consistency Frank Lichtenheld
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11758963642149-git-send-email-frank@lichtenheld.de \
--to=frank@lichtenheld.de \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).