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-rename () {
47 (( CURRENT == 2 )) && __vcsh_repositories
48 #TODO tell the user to add a new name
51 function _vcsh-run () {
52 (( CURRENT == 2 )) && __vcsh_repositories
56 function _vcsh-setup () {
57 (( CURRENT == 2 )) && __vcsh_repositories
60 function _vcsh-version () {
64 function _vcsh-which () {
68 function _vcsh-write-gitignore () {
69 (( CURRENT == 2 )) && __vcsh_repositories
73 local curcontext="${curcontext}"
74 local state vcshcommand
75 local -a args subcommands
78 "clone:clone an existing repository"
79 "delete:delete an existing repository"
80 "enter:enter repository; spawn new <\$SHELL>"
82 "init:initialize an empty repository"
83 "list:list all local vcsh repositories"
84 "list-tracked:list all files tracked by vcsh"
85 "list-tracked-by:list files tracked by a repository"
86 "rename:rename a repository"
87 "run:run command with <\$GIT_DIR> and <\$GIT_WORK_TREE> set"
88 "setup:set up repository with recommended settings"
89 "version:print version information"
90 "which:find <substring> in name of any tracked file"
91 "write-gitignore:write .gitignore.d/<repo> via git ls-files"
95 '-c[source <file> prior to other configuration files]:config files:_path_files'
96 '-d[enable debug mode]'
97 '-v[enable verbose mode]'
98 '*:: :->subcommand_or_options_or_repo'
101 _arguments -C ${args} && return
103 if [[ ${state} == "subcommand_or_options_or_repo" ]]; then
104 if (( CURRENT == 1 )); then
105 _describe -t subcommands 'vcsh sub-commands' subcommands
108 vcshcommand="${words[1]}"
109 if ! (( ${+functions[_vcsh-$vcshcommand]} )); then
110 # There is no handler function, so this is probably the name
111 # of a repository. Act accordingly.
112 _message "git sub-command"
113 #TODO and now we need to complete on git subcommands
115 curcontext="${curcontext%:*:*}:vcsh-${vcshcommand}:"
116 _call_function ret _vcsh-${vcshcommand}