All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
3 function __vcsh_repositories () {
6 repos=( ${(f)"$(command vcsh list)"} )
7 _describe -t repos 'repositories' repos
10 function __vcsh_not_implemented_yet () {
11 _message "Subcommand completion '${1#*-}': not implemented yet"
14 function _vcsh-clone () {
15 __vcsh_not_implemented_yet "$0" #TODO
18 function _vcsh-delete () {
19 (( CURRENT == 2 )) && __vcsh_repositories
22 function _vcsh-enter () {
23 (( CURRENT == 2 )) && __vcsh_repositories
26 function _vcsh-help () {
30 function _vcsh-init () {
34 function _vcsh-list () {
38 function _vcsh-list-tracked () {
42 function _vcsh-list-tracked-by () {
43 (( CURRENT == 2 )) && __vcsh_repositories
46 function _vcsh-pull () {
50 function _vcsh-rename () {
51 (( CURRENT == 2 )) && __vcsh_repositories
52 (( CURRENT == 3 )) && _message "new repository name"
53 (( CURRENT > 3 )) && _nothing
56 function _vcsh-run () {
57 (( CURRENT == 2 )) && __vcsh_repositories
58 if (( CURRENT >= 3 )); then
59 words=( "${(@)words[3,-1]}" )
65 function _vcsh-upgrade () {
66 (( CURRENT == 2 )) && __vcsh_repositories
69 function _vcsh-version () {
73 function _vcsh-which () {
77 function _vcsh-write-gitignore () {
78 (( CURRENT == 2 )) && __vcsh_repositories
82 local curcontext="${curcontext}"
83 local state vcshcommand
84 local -a args subcommands
87 "clone:clone an existing repository"
88 "delete:delete an existing repository"
89 "enter:enter repository; spawn new <\$SHELL>"
91 "init:initialize an empty repository"
92 "list:list all local vcsh repositories"
93 "list-tracked:list all files tracked by vcsh"
94 "list-tracked-by:list files tracked by a repository"
95 "pull:pull from all vcsh remotes"
96 "rename:rename a repository"
97 "run:run command with <\$GIT_DIR> and <\$GIT_WORK_TREE> set"
98 "upgrade:upgrade repository to currently recommended settings"
99 "version:print version information"
100 "which:find <substring> in name of any tracked file"
101 "write-gitignore:write .gitignore.d/<repo> via git ls-files"
105 '-c[source <file> prior to other configuration files]:config files:_path_files'
106 '-d[enable debug mode]'
107 '-v[enable verbose mode]'
108 '*:: :->subcommand_or_options_or_repo'
111 _arguments -C ${args} && return
113 if [[ ${state} == "subcommand_or_options_or_repo" ]]; then
114 if (( CURRENT == 1 )); then
115 _describe -t subcommands 'vcsh sub-commands' subcommands
118 vcshcommand="${words[1]}"
119 if ! (( ${+functions[_vcsh-$vcshcommand]} )); then
120 # There is no handler function, so this is probably the name
121 # of a repository. Act accordingly.
124 curcontext="${curcontext%:*:*}:vcsh-${vcshcommand}:"
125 _call_function ret _vcsh-${vcshcommand}