X-Git-Url: https://git.madduck.net/code/vcsh.git/blobdiff_plain/29b6c287d196c01091d6fbadf511aa387d74e2a2..b99d26914007cd902b92c5fe0524a233d778a724:/_vcsh diff --git a/_vcsh b/_vcsh index 73a04a5..bc1a7b9 100644 --- a/_vcsh +++ b/_vcsh @@ -23,6 +23,10 @@ function _vcsh-enter () { (( CURRENT == 2 )) && __vcsh_repositories } +function _vcsh-foreach () { + _dispatch git git +} + function _vcsh-help () { _nothing } @@ -91,11 +95,15 @@ function _vcsh () { local state vcshcommand local -a args subcommands + local VCSH_REPO_D + : ${VCSH_REPO_D:="${XDG_CONFIG_HOME:-"$HOME/.config"}/vcsh/repo.d"} + subcommands=( "clone:clone an existing repository" "commit:commit in all repositories" "delete:delete an existing repository" "enter:enter repository; spawn new <\$SHELL>" + "foreach:execute for all repos" "help:display help" "init:initialize an empty repository" "list:list all local vcsh repositories" @@ -130,7 +138,7 @@ function _vcsh () { if ! (( ${+functions[_vcsh-$vcshcommand]} )); then # There is no handler function, so this is probably the name # of a repository. Act accordingly. - _dispatch git git + GIT_DIR=$VCSH_REPO_D/$words[1].git _dispatch git git else curcontext="${curcontext%:*:*}:vcsh-${vcshcommand}:" _call_function ret _vcsh-${vcshcommand}