public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Sloof Lirpa <sitemaster@cox•net>
To: Junio C Hamamo <junkio@cox•net>
Cc: git@vger•kernel.org
Subject: [PATCH 2/3] Human friendly git: accept human readable options.
Date: Sun, 1 Apr 2007 00:00:00 +0000	[thread overview]
Message-ID: <7vlkhd557f.fsf@assigned-by-dhcp.cox.net> (raw)

In kindergarten, we were taught to say "please" when asking
another person to do something for us.  With this, git
understands:

	$ git, please commit

Signed-off-by: Sloof Lirpa <sitemaster@cox•net>
---
 git.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/git.c b/git.c
index 5b1bc2a..7909fd3 100644
--- a/git.c
+++ b/git.c
@@ -34,7 +34,15 @@ static int handle_options(const char*** argv, int* argc)
 
 	while (*argc > 0) {
 		const char *cmd = (*argv)[0];
-		if (cmd[0] != '-')
+
+		/*
+		 * Additional "human friendly" options do not begin
+		 * with '-'.
+		 */
+		if (!strcmp(cmd, "please"))
+			; /* no-op */
+
+		else if (cmd[0] != '-')
 			break;
 
 		/*
@@ -42,13 +50,13 @@ static int handle_options(const char*** argv, int* argc)
 		 * commands can be written with "--" prepended
 		 * to make them look like flags.
 		 */
-		if (!strcmp(cmd, "--help") || !strcmp(cmd, "--version"))
+		else if (!strcmp(cmd, "--help") || !strcmp(cmd, "--version"))
 			break;
 
 		/*
 		 * Check remaining flags.
 		 */
-		if (!prefixcmp(cmd, "--exec-path")) {
+		else if (!prefixcmp(cmd, "--exec-path")) {
 			cmd += 11;
 			if (*cmd == '=')
 				git_set_exec_path(cmd + 1);
-- 
1.5.1.rc3.26.g4f01

                 reply	other threads:[~2007-04-01  0:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=7vlkhd557f.fsf@assigned-by-dhcp.cox.net \
    --to=sitemaster@cox$(echo .)net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=junkio@cox$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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