summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_vcsh
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2015-05-05 23:32:59 +0200
committerAxel Beckert <abe@deuxchevaux.org>2015-05-05 23:58:59 +0200
commitdb38e167634b6c2217eec3a5aafc37c46d9e5a8d (patch)
treedaa342d423febbd3a5a7ef97053037677fab004a /Completion/Unix/Command/_vcsh
parent01eea47617a6e06debdb4330f92ae69f92089fd2 (diff)
parent3c3c8d3d13fd4cf6c03f81ca8dc18a1efd561728 (diff)
downloadzsh-db38e167634b6c2217eec3a5aafc37c46d9e5a8d.tar.gz
zsh-db38e167634b6c2217eec3a5aafc37c46d9e5a8d.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Completion/Unix/Command/_vcsh')
-rw-r--r--Completion/Unix/Command/_vcsh88
1 files changed, 21 insertions, 67 deletions
diff --git a/Completion/Unix/Command/_vcsh b/Completion/Unix/Command/_vcsh
index 47dbd9e69..00aed7d28 100644
--- a/Completion/Unix/Command/_vcsh
+++ b/Completion/Unix/Command/_vcsh
@@ -1,60 +1,29 @@
#compdef vcsh
function __vcsh_repositories () {
- local expl
local -a repos
- repos=( ${(f)"$(command vcsh list)"} )
- _describe -t repos 'repositories' repos
-}
-
-function __vcsh_not_implemented_yet () {
- _message "Subcommand completion '${1#*-}': not implemented yet"
+ repos=( ${(f)"$(_call_program repositories vcsh list)"} )
+ _describe -t repositories 'repository' repos
}
function _vcsh-clone () {
- __vcsh_not_implemented_yet "$0" #TODO
-}
-
-function _vcsh-delete () {
- (( CURRENT == 2 )) && __vcsh_repositories
+ _default #TODO
}
-function _vcsh-enter () {
- (( CURRENT == 2 )) && __vcsh_repositories
-}
-
-function _vcsh-help () {
- _nothing
-}
-
-function _vcsh-init () {
- _nothing
-}
-
-function _vcsh-list () {
- _nothing
-}
-
-function _vcsh-list-tracked () {
- _nothing
-}
-
-function _vcsh-list-tracked-by () {
- (( CURRENT == 2 )) && __vcsh_repositories
-}
-
-function _vcsh-pull () {
- _nothing
-}
-
-function _vcsh-push () {
- _nothing
-}
+local func
+for func in help init list list-tracked pull push version; do
+ _vcsh-$func() { _nothing }
+done
+for func in delete enter list-tracked-by upgrade write-gitignore; do
+ _vcsh-$func() { (( CURRENT == 2 )) && __vcsh_repositories }
+done
function _vcsh-rename () {
- (( CURRENT == 2 )) && __vcsh_repositories
- (( CURRENT == 3 )) && _message "new repository name"
- (( CURRENT > 3 )) && _nothing
+ case $CURRENT in
+ 2) __vcsh_repositories ;;
+ 3) _message "new repository name" ;;
+ *) _nothing ;;
+ esac
}
function _vcsh-run () {
@@ -66,24 +35,8 @@ function _vcsh-run () {
fi
}
-function _vcsh-upgrade () {
- (( CURRENT == 2 )) && __vcsh_repositories
-}
-
-function _vcsh-version () {
- _nothing
-}
-
-function _vcsh-which () {
- _files
-}
-
-function _vcsh-write-gitignore () {
- (( CURRENT == 2 )) && __vcsh_repositories
-}
-
function _vcsh () {
- local curcontext="${curcontext}"
+ local curcontext="${curcontext}" ret=1
local state vcshcommand
local -a args subcommands
@@ -112,24 +65,25 @@ function _vcsh () {
'*:: :->subcommand_or_options_or_repo'
)
- _arguments -C ${args} && return
+ _arguments -C ${args} && ret=0
if [[ ${state} == "subcommand_or_options_or_repo" ]]; then
if (( CURRENT == 1 )); then
- _describe -t subcommands 'vcsh sub-commands' subcommands
- __vcsh_repositories
+ _describe -t subcommands 'vcsh sub-commands' subcommands && ret=0
+ __vcsh_repositories && ret=0
else
vcshcommand="${words[1]}"
if ! (( ${+functions[_vcsh-$vcshcommand]} )); then
# There is no handler function, so this is probably the name
# of a repository. Act accordingly.
- _dispatch git git
+ _dispatch git git && ret=0
else
curcontext="${curcontext%:*:*}:vcsh-${vcshcommand}:"
_call_function ret _vcsh-${vcshcommand}
fi
fi
fi
+ return ret
}
_vcsh "$@"