1## vim:ft=zsh
2## Written by Frank Terbeck <ft@bewatermyfriend.org>
3## Distributed under the same BSD-ish license as zsh itself.
4
5emulate -L zsh
6setopt extendedglob
7
8local sys
9local -a disabled enabled
10local -Ax vcs_comm
11
12zstyle -a ":vcs_info:-init-:${1:-default}:-all-" "enable" enabled
13(( ${#enabled} == 0 )) && enabled=( all )
14
15if (( ${+VCS_INFO_backends} == 0 )); then
16  autoload -Uz vcs_info_setsys
17  vcs_info_setsys
18fi
19
20if [[ -n ${(M)enabled:#(#i)all} ]] ; then
21    enabled=( ${VCS_INFO_backends} )
22    zstyle -a ":vcs_info:-init-:${1:-default}:-all-" "disable" disabled
23else
24    for sys in ${VCS_INFO_backends} ; do
25        [[ -z ${(M)enabled:#$sys} ]] && disabled+=( ${sys} )
26    done
27    enabled=( ${VCS_INFO_backends} )
28fi
29
30print -l '## list of supported version control backends:' \
31         '## disabled systems are prefixed by a hash sign (#)'
32
33for sys in ${VCS_INFO_backends} ; do
34    [[ -n ${(M)disabled:#${sys}} ]] && printf '#'
35    printf '%s\n' ${sys}
36done
37
38print -l '## flavours (cannot be used in the enable or disable styles; they' \
39         '## are enabled and disabled with their master [git-svn -> git])'   \
40         '## they *can* be used in contexts: '\'':vcs_info:git-svn:*'\''.'
41
42for sys in ${VCS_INFO_backends} ; do
43    VCS_INFO_detect_${sys} --flavours
44done
45return 0
46