git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thiago Farina <tfransosi@gmail.com>
To: git@vger.kernel.org
Cc: Thiago Farina <tfransosi@gmail.com>
Subject: [PATCH] Trivial fix: Display a more friendly message with git-shell.
Date: Sun, 20 Sep 2009 13:11:12 -0400	[thread overview]
Message-ID: <1253466672-21051-1-git-send-email-tfransosi@gmail.com> (raw)

Instead of simply die without give a helpful message, displays the usage
string that shows to the user how it can be used.

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
---
 shell.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/shell.c b/shell.c
index e4864e0..aa7f47e 100644
--- a/shell.c
+++ b/shell.c
@@ -3,6 +3,8 @@
 #include "exec_cmd.h"
 #include "strbuf.h"
 
+static const char shell_usage[] = "git shell -c <command> <argument>";
+
 static int do_generic_cmd(const char *me, char *arg)
 {
 	const char *my_argv[4];
@@ -74,7 +76,7 @@ int main(int argc, char **argv)
 	 * where "cmd" is a very limited subset of git commands.
 	 */
 	else if (argc != 3 || strcmp(argv[1], "-c"))
-		die("What do you think I am? A shell?");
+		usage(shell_usage);
 
 	prog = argv[2];
 	if (!strncmp(prog, "git", 3) && isspace(prog[3]))
-- 
1.6.5.rc1.37.gf5c31.dirty

             reply	other threads:[~2009-09-20 17:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-20 17:11 Thiago Farina [this message]
2009-09-21  4:21 ` [PATCH] Trivial fix: Display a more friendly message with git-shell Tay Ray Chuan
2009-09-21  6:17 ` Johannes Sixt
2009-09-21  6:45   ` Matthieu Moy
2009-09-21 20:45     ` Thiago Farina
2009-09-22  7:28       ` Matthieu Moy
2009-09-22  8:15         ` Heiko Voigt
2009-09-22  8:17         ` Jakub Narebski

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=1253466672-21051-1-git-send-email-tfransosi@gmail.com \
    --to=tfransosi@gmail.com \
    --cc=git@vger.kernel.org \
    /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).