{"thread":{"id":"6662","subject":"[PATCH 3/8] bash: Complete long options to git-add.","startedAt":"2007-02-04T07:38:23Z","lastAt":"2007-02-04T07:38:23Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"33538","messageId":"20070204073823.GC17603@spearce.org","threadId":"6662","inReplyTo":null,"subject":"[PATCH 3/8] bash: Complete long options to git-add.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-04T07:38:23Z","receivedAt":"2007-02-04T07:38:23Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"The new --interactive mode of git-add can be very useful, so users\nwill probably want to have completion for it.\n\nLikewise the new git-add--interactive executable is actually a\nplumbing command.  Its invoked by `git add --interactive` and is\nnot intended to be invoked directly by the user.  Therefore we\nshould hide it from the list of available Git commands.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n contrib/completion/git-completion.bash |   16 ++++++++++++++++\n 1 files changed, 16 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex b87f96d..93f2af5 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -235,6 +235,7 @@ __git_commands ()\n \tfor i in $(git help -a|egrep '^ ')\n \tdo\n \t\tcase $i in\n+\t\tadd--interactive) : plumbing;;\n \t\tcat-file)         : plumbing;;\n \t\tcheck-ref-format) : plumbing;;\n \t\tcommit-tree)      : plumbing;;\n@@ -358,6 +359,19 @@ _git_apply ()\n \tCOMPREPLY=()\n }\n \n+_git_add ()\n+{\n+\tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n+\tcase \"$cur\" in\n+\t--*)\n+\t\tCOMPREPLY=($(compgen -W \"\n+\t\t\t--interactive\n+\t\t\t\" -- \"$cur\"))\n+\t\treturn\n+\tesac\n+\tCOMPREPLY=()\n+}\n+\n _git_branch ()\n {\n \tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n@@ -786,6 +800,7 @@ _git ()\n \n \tcase \"$command\" in\n \tam)          _git_am ;;\n+\tadd)         _git_add ;;\n \tapply)       _git_apply ;;\n \tbranch)      _git_branch ;;\n \tcheckout)    _git_checkout ;;\n@@ -852,6 +867,7 @@ complete -o default -o nospace -F _git_log git-whatchanged\n # included the '.exe' suffix.\n #\n if [ Cygwin = \"$(uname -o 2>/dev/null)\" ]; then\n+complete -o default            -F _git_add git-add.exe\n complete -o default            -F _git_apply git-apply.exe\n complete -o default -o nospace -F _git git.exe\n complete -o default            -F _git_branch git-branch.exe\n-- \n1.5.0.rc3.22.g5057\n"}]}