zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _git: Completion for `notes' sub-command
@ 2010-02-13 11:01 Frank Terbeck
  2010-02-13 11:20 ` Nikolai Weibull
  0 siblings, 1 reply; 6+ messages in thread
From: Frank Terbeck @ 2010-02-13 11:01 UTC (permalink / raw)
  To: zsh-workers

---
 Completion/Unix/Command/_git |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 5371fd5..d3da5e2 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1,4 +1,4 @@
-#compdef git git-add git-am git-annotate git-apply git-applymbox git-applypatch git-archimport git-archive git-bisect git-blame git-branch git-cat-file git-check-attr git-check-ref-format git-checkout git-checkout-index git-cherry git-cherry-pick git-clean git-clone git-clone-pack git-commit git-commit-tree git-convert-objects git-count-objects git-cvsexportcommit git-cvsimport git-cvsserver git-daemon git-describe git-diff git-diff-files git-diff-index git-diff-stages git-diff-tree git-fast-import git-fetch git-fetch-pack git-fmt-merge-msg git-for-each-ref git-format-patch git-fsck git-gc git-get-tar-commit-id git-grep git-hash-object git-http-fetch git-http-push git-imap-send git-index-pack git-init git-instaweb git-local-fetch git-log git-lost-found git-ls-files git-ls-remote git-ls-tree git-mailinfo git-mailsplit git-merge git-merge-base git-merge-file git-merge-index git-merge-one-file git-merge-tree git-mergetool git-mktag git-mktree git-mv git-name-rev git-pack-objects git-pack-redundant git-pack-refs git-patch-id git-peek-remote git-prune git-prune-packed git-pull git-push git-quiltimport git-read-tree git-rebase git-receive-pack git-reflog git-relink git-remote git-repack gut-runstatus git-config git-request-pull git-rerere git-reset git-rev-list git-rev-parse git-revert git-rm git-send-email git-send-pack git-sh-setup git-shell git-shortlog git-show git-show-branch git-show-index git-show-ref git-ssh-fetch git-ssh-upload git-status git-stripspace git-svn git-svnimport git-symbolic-ref git-tag git-tar-tree git-unpack-file git-unpack-objects git-update-index git-update-ref git-update-server-info git-upload-archive git-upload-pack git-var git-verify-pack git-verify-tag git-whatchanged git-write-tree
+#compdef git git-add git-am git-annotate git-apply git-applymbox git-applypatch git-archimport git-archive git-bisect git-blame git-branch git-cat-file git-check-attr git-check-ref-format git-checkout git-checkout-index git-cherry git-cherry-pick git-clean git-clone git-clone-pack git-commit git-commit-tree git-convert-objects git-count-objects git-cvsexportcommit git-cvsimport git-cvsserver git-daemon git-describe git-diff git-diff-files git-diff-index git-diff-stages git-diff-tree git-fast-import git-fetch git-fetch-pack git-fmt-merge-msg git-for-each-ref git-format-patch git-fsck git-gc git-get-tar-commit-id git-grep git-hash-object git-http-fetch git-http-push git-imap-send git-index-pack git-init git-instaweb git-local-fetch git-log git-lost-found git-ls-files git-ls-remote git-ls-tree git-mailinfo git-mailsplit git-merge git-merge-base git-merge-file git-merge-index git-merge-one-file git-merge-tree git-mergetool git-mktag git-mktree git-mv git-name-rev git-notes git-pack-objects git-pack-redundant git-pack-refs git-patch-id git-peek-remote git-prune git-prune-packed git-pull git-push git-quiltimport git-read-tree git-rebase git-receive-pack git-reflog git-relink git-remote git-repack gut-runstatus git-config git-request-pull git-rerere git-reset git-rev-list git-rev-parse git-revert git-rm git-send-email git-send-pack git-sh-setup git-shell git-shortlog git-show git-show-branch git-show-index git-show-ref git-ssh-fetch git-ssh-upload git-status git-stripspace git-svn git-svnimport git-symbolic-ref git-tag git-tar-tree git-unpack-file git-unpack-objects git-update-index git-update-ref git-update-server-info git-upload-archive git-upload-pack git-var git-verify-pack git-verify-tag git-whatchanged git-write-tree
 
 # TODO: All if (( words[(I)-option] )) should be turned into
 # if (( words[(I)-option] > 0 && words[(I)-option] < CURRENT )), as the user
@@ -225,6 +225,7 @@ _git_commands () {
     'mktag:create tag object'
     'mktree:build tree-object from ls-tree formatted text'
     'name-rev:find symbolic names for given revisions'
+    'notes:add/inspect commit notes'
     'pack-objects:create packed archive of objects'
     'pack-redundant:find redundant pack files'
     'pack-refs:pack heads and tags for efficient repository access'
@@ -998,6 +999,37 @@ _git-name-rev () {
     '(--stdin --all)*:commit-ish:__git_revisions' && ret=0
 }
 
+(( $+functions[_git-notes] )) ||
+_git-notes () {
+  local expl
+  local -a notes_cmds
+
+  notes_cmds=(
+    edit:"edit note"
+    show:"shot commit note"
+  )
+
+  if (( CURRENT == 2 )); then
+    _describe -t command "git-notes commands" notes_cmds && ret=0
+  else
+    case $words[2] in
+      (show)
+        _arguments \
+          '*:commit id:__git_commits' && ret=0
+        ;;
+      (edit)
+        _arguments \
+          '-F[use file'\''s contents as the commit note]:file:_path_files' \
+          '-m[use the given message as the commit note]:message' \
+          '*:commit id:__git_commits' && ret=0
+        ;;
+      (*)
+        _nothing
+        ;;
+    esac
+  fi
+}
+
 (( $+functions[_git-pack-redundant] )) ||
 _git-pack-redundant () {
   _arguments \
-- 
1.7.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: _git: Completion for `notes' sub-command
  2010-02-13 11:01 PATCH: _git: Completion for `notes' sub-command Frank Terbeck
@ 2010-02-13 11:20 ` Nikolai Weibull
  2010-02-13 11:56   ` Frank Terbeck
  0 siblings, 1 reply; 6+ messages in thread
From: Nikolai Weibull @ 2010-02-13 11:20 UTC (permalink / raw)
  To: Frank Terbeck; +Cc: zsh-workers

2010/2/13 Frank Terbeck <ft@bewatermyfriend.org>:

> +    show:"shot commit note"


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: _git: Completion for `notes' sub-command
  2010-02-13 11:20 ` Nikolai Weibull
@ 2010-02-13 11:56   ` Frank Terbeck
  2010-02-13 12:39     ` Frank Terbeck
  2010-02-14 15:30     ` Nikolai Weibull
  0 siblings, 2 replies; 6+ messages in thread
From: Frank Terbeck @ 2010-02-13 11:56 UTC (permalink / raw)
  To: Nikolai Weibull; +Cc: zsh-workers

Nikolai Weibull wrote:
> 2010/2/13 Frank Terbeck <ft@bewatermyfriend.org>:
>> +    show:"shot commit note"

Oops, indeed. Thanks.

While we're at it; _git's `#compdef' line is ridiculously long.
`git send-email' warns about a line longer than 998 characters, which
seems to be a limit in SMTP described in
<http://www.ietf.org/rfc/rfc2821.txt>.

Since git 1.6.0 you're not supposed to use `git-xxx' anymore, but to
use `git xxx'. And recently, git 1.7.0 was released, so I think it's
save to remove all those explicit comdefs.

I'll trim the `#compdef line down, unless people object - soon.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925


^ permalink raw reply	[flat|nested] 6+ messages in thread

* PATCH: _git: Completion for `notes' sub-command
  2010-02-13 11:56   ` Frank Terbeck
@ 2010-02-13 12:39     ` Frank Terbeck
  2010-02-13 12:43       ` Frank Terbeck
  2010-02-14 15:30     ` Nikolai Weibull
  1 sibling, 1 reply; 6+ messages in thread
From: Frank Terbeck @ 2010-02-13 12:39 UTC (permalink / raw)
  To: zsh-workers; +Cc: Nikolai Weibull, Frank Terbeck

This includes a drastic shortening of _git's `#compdef' line. This
should be safe since users are not supposed to call `git-xxx' directly
anymore for quite some time now.

People who cannot be bothered to "drop the dash" should consider adding
something like this to their .zshrc (this assumes they have added the
output of `git --exec-path' to their $PATH - otherwise this doesn't make
sense whatsoever):

    compdef _git ${(M)${(k)commands}:#git-*}; do

Regards, Frank
---
 Completion/Unix/Command/_git |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 5371fd5..c87593e 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1,4 +1,4 @@
-#compdef git git-add git-am git-annotate git-apply git-applymbox git-applypatch git-archimport git-archive git-bisect git-blame git-branch git-cat-file git-check-attr git-check-ref-format git-checkout git-checkout-index git-cherry git-cherry-pick git-clean git-clone git-clone-pack git-commit git-commit-tree git-convert-objects git-count-objects git-cvsexportcommit git-cvsimport git-cvsserver git-daemon git-describe git-diff git-diff-files git-diff-index git-diff-stages git-diff-tree git-fast-import git-fetch git-fetch-pack git-fmt-merge-msg git-for-each-ref git-format-patch git-fsck git-gc git-get-tar-commit-id git-grep git-hash-object git-http-fetch git-http-push git-imap-send git-index-pack git-init git-instaweb git-local-fetch git-log git-lost-found git-ls-files git-ls-remote git-ls-tree git-mailinfo git-mailsplit git-merge git-merge-base git-merge-file git-merge-index git-merge-one-file git-merge-tree git-mergetool git-mktag git-mktree git-mv git-name-rev git-pack-objects git-pack-redundant git-pack-refs git-patch-id git-peek-remote git-prune git-prune-packed git-pull git-push git-quiltimport git-read-tree git-rebase git-receive-pack git-reflog git-relink git-remote git-repack gut-runstatus git-config git-request-pull git-rerere git-reset git-rev-list git-rev-parse git-revert git-rm git-send-email git-send-pack git-sh-setup git-shell git-shortlog git-show git-show-branch git-show-index git-show-ref git-ssh-fetch git-ssh-upload git-status git-stripspace git-svn git-svnimport git-symbolic-ref git-tag git-tar-tree git-unpack-file git-unpack-objects git-update-index git-update-ref git-update-server-info git-upload-archive git-upload-pack git-var git-verify-pack git-verify-tag git-whatchanged git-write-tree
+#compdef git git-cvsserver git-receive-pack git-upload-archive git-upload-pack git-shell
 
 # TODO: All if (( words[(I)-option] )) should be turned into
 # if (( words[(I)-option] > 0 && words[(I)-option] < CURRENT )), as the user
@@ -225,6 +225,7 @@ _git_commands () {
     'mktag:create tag object'
     'mktree:build tree-object from ls-tree formatted text'
     'name-rev:find symbolic names for given revisions'
+    'notes:add/inspect commit notes'
     'pack-objects:create packed archive of objects'
     'pack-redundant:find redundant pack files'
     'pack-refs:pack heads and tags for efficient repository access'
@@ -998,6 +999,37 @@ _git-name-rev () {
     '(--stdin --all)*:commit-ish:__git_revisions' && ret=0
 }
 
+(( $+functions[_git-notes] )) ||
+_git-notes () {
+  local expl
+  local -a notes_cmds
+
+  notes_cmds=(
+    edit:"edit note"
+    show:"show commit note"
+  )
+
+  if (( CURRENT == 2 )); then
+    _describe -t command "git-notes commands" notes_cmds && ret=0
+  else
+    case $words[2] in
+      (show)
+        _arguments \
+          '*:commit id:__git_commits' && ret=0
+        ;;
+      (edit)
+        _arguments \
+          '-F[use file'\''s contents as the commit note]:file:_path_files' \
+          '-m[use the given message as the commit note]:message' \
+          '*:commit id:__git_commits' && ret=0
+        ;;
+      (*)
+        _nothing
+        ;;
+    esac
+  fi
+}
+
 (( $+functions[_git-pack-redundant] )) ||
 _git-pack-redundant () {
   _arguments \
-- 
1.7.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: _git: Completion for `notes' sub-command
  2010-02-13 12:39     ` Frank Terbeck
@ 2010-02-13 12:43       ` Frank Terbeck
  0 siblings, 0 replies; 6+ messages in thread
From: Frank Terbeck @ 2010-02-13 12:43 UTC (permalink / raw)
  To: zsh-workers; +Cc: Nikolai Weibull

Frank Terbeck wrote:
[...]
> People who cannot be bothered to "drop the dash" should consider adding
> something like this to their .zshrc (this assumes they have added the
> output of `git --exec-path' to their $PATH - otherwise this doesn't make
> sense whatsoever):
>
>     compdef _git ${(M)${(k)commands}:#git-*}; do

The '; do' is there only be accident. It should read:

      compdef _git ${(M)${(k)commands}:#git-*}

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: _git: Completion for `notes' sub-command
  2010-02-13 11:56   ` Frank Terbeck
  2010-02-13 12:39     ` Frank Terbeck
@ 2010-02-14 15:30     ` Nikolai Weibull
  1 sibling, 0 replies; 6+ messages in thread
From: Nikolai Weibull @ 2010-02-14 15:30 UTC (permalink / raw)
  To: Frank Terbeck; +Cc: zsh-workers

On Sat, Feb 13, 2010 at 12:56, Frank Terbeck <ft@bewatermyfriend.org> wrote:

> While we're at it; _git's `#compdef' line is ridiculously long.

I agree.  It’s time to drop all the deprecated dash-stuff.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-02-14 15:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-13 11:01 PATCH: _git: Completion for `notes' sub-command Frank Terbeck
2010-02-13 11:20 ` Nikolai Weibull
2010-02-13 11:56   ` Frank Terbeck
2010-02-13 12:39     ` Frank Terbeck
2010-02-13 12:43       ` Frank Terbeck
2010-02-14 15:30     ` Nikolai Weibull

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).