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-foreach () {
27 _dispatch vcsh-foreach git
30 function _vcsh-help () {
34 function _vcsh-init () {
38 function _vcsh-list () {
42 function _vcsh-list-tracked () {
43 (( CURRENT == 2 )) && __vcsh_repositories
46 function _vcsh-list-untracked () {
50 function _vcsh-pull () {
54 function _vcsh-push () {
58 function _vcsh-rename () {
59 (( CURRENT == 2 )) && __vcsh_repositories
60 (( CURRENT == 3 )) && _message "new repository name"
61 (( CURRENT > 3 )) && _nothing
64 function _vcsh-run () {
65 (( CURRENT == 2 )) && __vcsh_repositories
66 if (( CURRENT >= 3 )); then
67 words=( "${(@)words[3,-1]}" )
73 function _vcsh-status () {
74 (( CURRENT == 2 )) && __vcsh_repositories
77 function _vcsh-upgrade () {
78 (( CURRENT == 2 )) && __vcsh_repositories
81 function _vcsh-version () {
85 function _vcsh-which () {
89 function _vcsh-write-gitignore () {
90 (( CURRENT == 2 )) && __vcsh_repositories
94 local curcontext="${curcontext}"
95 local state vcshcommand
96 local -a args subcommands
99 : ${VCSH_REPO_D:="${XDG_CONFIG_HOME:-"$HOME/.config"}/vcsh/repo.d"}
102 "clone:clone an existing repository"
103 "commit:commit in all repositories"
104 "delete:delete an existing repository"
105 "enter:enter repository; spawn new <\$SHELL>"
106 "foreach:execute for all repos"
108 "init:initialize an empty repository"
109 "list:list all local vcsh repositories"
110 "list-tracked:list all files tracked by vcsh"
111 "list-untracked:list all files not tracked by vcsh"
112 "pull:pull from all vcsh remotes"
113 "push:push to vcsh remotes"
114 "rename:rename a repository"
115 "run:run command with <\$GIT_DIR> and <\$GIT_WORK_TREE> set"
116 "status:show statuses of all/one vcsh repositories"
117 "upgrade:upgrade repository to currently recommended settings"
118 "version:print version information"
119 "which:find <substring> in name of any tracked file"
120 "write-gitignore:write .gitignore.d/<repo> via git ls-files"
124 '-c[source <file> prior to other configuration files]:config files:_path_files'
125 '-d[enable debug mode]'
126 '-v[enable verbose mode]'
127 '*:: :->subcommand_or_options_or_repo'
130 _arguments -C ${args} && return
132 if [[ ${state} == "subcommand_or_options_or_repo" ]]; then
133 if (( CURRENT == 1 )); then
134 _describe -t subcommands 'vcsh sub-commands' subcommands
137 vcshcommand="${words[1]}"
138 if ! (( ${+functions[_vcsh-$vcshcommand]} )); then
139 # There is no handler function, so this is probably the name
140 # of a repository. Act accordingly.
141 # FIXME: this may want to use '_dispatch vcsh git'
142 GIT_DIR=$VCSH_REPO_D/$words[1].git _dispatch git git
144 curcontext="${curcontext%:*:*}:vcsh-${vcshcommand}:"
145 _call_function ret _vcsh-${vcshcommand}