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

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

From
SLSloof Lirpa <sitemaster@cox.net>
Date
Apr 1, 2007, 00:00 UTC
Message-ID
<7vlkhd557f.fsf@assigned-by-dhcp.cox.net>

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
Message 1 of 1 in “Human friendly git: accept human readable options.”
  1. 2/3 Human friendly git: accept human readable options.Sloof Lirpa, Apr 1, 2007

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.