From c501c18a2c93fd5c1fc5773527a928ef0f5cf9ee Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Fri, 2 Sep 2011 14:58:44 +0200 Subject: [PATCH] #23 github: complete 'fork' command --- _github | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/_github b/_github index 52f4bac..ee02bc2 100644 --- a/_github +++ b/_github @@ -97,8 +97,9 @@ _github() { && ret=0 ;; (fork) - # TODO Not implemented - _message "${words[1]} command argument" && ret=0 + _arguments \ + '1: :_github_user_slash_repos' \ + && ret=0 ;; (home) # TODO Not implemented @@ -161,4 +162,16 @@ _github_branches() { _message -e branches 'branch' } +(( $+functions[_github_user_slash_repos] )) || +_github_user_slash_repos() { + local ret=1 + if compset -P '*/'; then + # TODO Make it contextual to the user + _wanted repos expl 'repo' _github_repos && ret=0 + else + _wanted users expl 'user' _github_users -qS/ && ret=0 + fi + return ret +} + _github "$@"