[PATCH 2/3] Human friendly git: accept human readable options.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 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


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]