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

[PATCH 1/3] completion: complete config variables for --get/getall/unset/unset-all

From
Stephen Boyd <bebarino@gmail.com>
Date
May 7, 2009, 06:15 UTC
Message-ID
<1241676906-29783-1-git-send-email-bebarino@gmail.com>

This should make it easier for users to get and unset their configuration variables without having to open documentation or dig through their configuration file.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
---
 contrib/completion/git-completion.bash |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 1683e6d..72a16a1 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1322,6 +1322,17 @@ _git_send_email ()
 	COMPREPLY=()
 }
 
+__git_config_get_set_variables ()
+{
+	for i in $(git --git-dir="$(__gitdir)" config --list); do
+		case "$i" in
+		*.*)
+			echo "${i/=*/}"
+			;;
+		esac
+	done
+}
+
 _git_config ()
 {
 	local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -1388,6 +1399,10 @@ _git_config ()
 		__gitcomp "$__git_send_email_suppresscc_options"
 		return
 		;;
+	--get|--get-all|--unset|--unset-all)
+		__gitcomp "$(__git_config_get_set_variables)"
+		return
+		;;
 	*.*)
 		COMPREPLY=()
 		return
-- 
1.6.3.rc4.29.g8146
Next: Stephen Boyd
Message 1 of 7 in “completion: complete config variables for --get/getall/unset/unset-all”
  1. 1/3 completion: complete config variables for --get/getall/unset/unset-allStephen Boyd, May 7, 2009
  2. 2/3 completion: add find_argument_and_value() functionStephen Boyd, May 7, 2009
  3. 2/3 completion: add find_argument_and_value() functionStephen Boyd, May 7, 2009
  4. 3/3 completion: use specified file (if any) when completing config varsStephen Boyd, May 7, 2009
  5. Shawn O. PearceMay 7, 2009
  6. Stephen BoydMay 7, 2009
  7. Stephen BoydMay 9, 2009

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.