git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 21/25] git-send-email: Usage message clean-up.

From
freku045@student.liu.se <freku045@student.liu.se>
Date
Dec 10, 2005, 19:37 UTC
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 <freku045@student.liu.se>
---
 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 <<EOT;
+$0 [options] <file | directory> [... 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 <<EOT;
-git-send-email [options] <file | directory> [... 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
Previous: freku045@student.liu.seNext: Junio C Hamano
Message 25 of 34 in “Usage message clean-up”
  1. 0/25 Usage message clean-upfreku045@student.liu.se, Dec 10, 2005
  2. 1/25 git-bisect: Use $0 instead of program name in usage message.freku045@student.liu.se, Dec 10, 2005
  3. 4/25 git-cherry: Print the usage message if we get an unknown option.freku045@student.liu.se, Dec 10, 2005
  4. 2/25 git-branch: Use $0 instead of program name in usage message.freku045@student.liu.se, Dec 10, 2005
  5. 3/25 git-checkout: Use $0 instead of program name in usage message.freku045@student.liu.se, Dec 10, 2005
  6. 9/25 git-format-patch: Use the 'die'-function where appropriate.freku045@student.liu.se, Dec 10, 2005
  7. 6/25 git-commit: Use $0 instead of program name in usage message.freku045@student.liu.se, Dec 10, 2005
  8. 5/25 git-clone: Use $0 instead of program name in usage message.freku045@student.liu.se, Dec 10, 2005
  9. 7/25 git-count-objects: Die with usage message if we are invoked incorrectly.freku045@student.liu.se, Dec 10, 2005
  10. Junio C HamanoDec 11, 2005
  11. 8/25 git-fetch: Print usage message if we get an unrecognized option.freku045@student.liu.se, Dec 10, 2005
  12. 10/25 git-grep: Print usage message on '-h' and '--help'.freku045@student.liu.se, Dec 10, 2005
  13. 16/25 git-push: Clean up usage messagefreku045@student.liu.se, Dec 10, 2005
  14. 15/25 git-pull: Don't print an extra new line at the end of the usage message.freku045@student.liu.se, Dec 10, 2005
  15. 13/25 git-merge: Print $0 instead of program name in usage message.freku045@student.liu.se, Dec 10, 2005
  16. 16/25 git-push: Clean-up usage messagefreku045@student.liu.se, Dec 10, 2005
  17. 14/25 git-prune: Print $0 instead of program name in usage message.freku045@student.liu.se, Dec 10, 2005
  18. 11/25 git-revert: Fix usage messagefreku045@student.liu.se, Dec 10, 2005
  19. 12/25 git-lost-found: Print usage message on incorrect invocation.freku045@student.liu.se, Dec 10, 2005
  20. 19/25 git-request-pull: Print usage message to stderr.freku045@student.liu.se, Dec 10, 2005
  21. 20/25 git-reset: Use $0 instead of program name in usage message.freku045@student.liu.se, Dec 10, 2005
  22. 17/25 git-relink: Print usage message to stderr.freku045@student.liu.se, Dec 10, 2005
  23. Junio C HamanoDec 11, 2005
  24. 18/25 git-repack: Print usage message on unrecognized option.freku045@student.liu.se, Dec 10, 2005
  25. 21/25 git-send-email: Usage message clean-up.freku045@student.liu.se, Dec 10, 2005
  26. Junio C HamanoDec 11, 2005
  27. 23/25 git-tag: Clean-up usage message.freku045@student.liu.se, Dec 10, 2005
  28. 22/25 git-status: Print usage message on incorrect invocation.freku045@student.liu.se, Dec 10, 2005
  29. 25/25 git-mv: Clean-up usage message.freku045@student.liu.se, Dec 10, 2005
  30. 24/25 git-verify-tag: Clean-up usage message.freku045@student.liu.se, Dec 10, 2005
  31. A Large Angry SCMDec 10, 2005
  32. Johannes SchindelinDec 10, 2005
  33. Junio C HamanoDec 11, 2005
  34. Nikolai WeibullDec 11, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.