summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_baz118
-rw-r--r--Completion/Unix/Command/_tla117
2 files changed, 10 insertions, 225 deletions
diff --git a/Completion/Unix/Command/_baz b/Completion/Unix/Command/_baz
index ceedc732d..c5a65437a 100644
--- a/Completion/Unix/Command/_baz
+++ b/Completion/Unix/Command/_baz
@@ -20,32 +20,20 @@ if zstyle -s ":completion:${curcontext}" hide-shortopts hide_short; then
 fi
 
 # completion functions
-
 (( $+functions[_baz_archives] )) ||
-_baz_archives () {
-  local expl completions library name_arg='-n'
-  if [[ -n $argv[(r)--library] ]]; then
-    library='library-'
-    # remove parameter from $@ before calling compadd
-    argv[(r)--library]=()
-    name_arg=
-  fi
-  completions=($(_call_program baz $BAZ ${library:-}archives $name_arg))
-  _description -V archives expl "${library:-}archives"
-  compadd "$@" "$expl[@]" -- "$completions[@]"
-}
+_baz_archives () { _arch_archives baz "$@" }
 
 (( $+functions[_baz_categories] )) ||
-_baz_categories () { _baz_namespace 1 "$argv[@]" }
+_baz_categories () { _arch_namespace baz 1 "$argv[@]" }
 
 (( $+functions[_baz_branches] )) ||
-_baz_branches () {_baz_namespace 2 "$argv[@]" }
+_baz_branches () { _arch_namespace baz 2 "$argv[@]" }
 
 (( $+functions[_baz_versions] )) ||
-_baz_versions () { _baz_namespace 3 "$argv[@]" }
+_baz_versions () { _arch_namespace baz 3 "$argv[@]" }
 
 (( $+functions[_baz_revisions] )) ||
-_baz_revisions () { _baz_namespace 4 "$argv[@]" }
+_baz_revisions () { _arch_namespace baz 4 "$argv[@]" }
 
 (( $+functions[_baz_local_revisions] )) ||
 _baz_local_revisions () {
@@ -58,102 +46,6 @@ _baz_local_revisions () {
   # Should complete based on -A, -R, -d
 }
 
-(( $+functions[_baz_namespace] )) ||
-_baz_namespace () { #double as arch_namespace_categories
-# takes an integer argument specifying how many components:
-# 1: category
-# 2: branch
-# 3: version
-# 4: revision
-  local suffix expl archive=`$BAZ my-default-archive 2> /dev/null`
-  local trailing_dashes=0
-  [[ -n $argv[(r)--trailing-dashes] ]] && trailing_dashes=1
-  local library
-  [[ -n $argv[(r)--library] ]] && library='library-';
-  local exclude_library_revisions=0
-  [[ -n $argv[(r)--exclude-library-revisions] ]] && exclude_library_revisions=1
-
-  if [ $1 -gt 1 ] || (( trailing_dashes )); then
-    suffix=(-q -S --)
-  fi
-  if [[ $PREFIX = */* ]]; then
-    compset -P '*/'
-    archive=${IPREFIX%/*}
-    _description -V categories expl "${library:-}categories in $archive"
-    compadd $suffix "$expl[@]" `$BAZ ${library:-}categories $archive`
-  elif [ -z $IPREFIX ]; then
-    local index=$(( words[(i)-A] + 1 ))
-    (( index < CURRENT )) || index=$(( words[(i)--archive] + 1 ))
-    (( index < CURRENT )) && archive=$words[$index]
-
-    if [ $archive ]; then
-      _description -V categories expl "${library:-}categories in $archive"
-      compadd "$expl[@]" $suffix `$BAZ ${library:-}categories $archive`
-    fi
-
-    _baz_archives -S / ${library:+--library}
-  fi
-  if [ $archive ] && [ $1 -gt 1 ] && [[ $PREFIX != *@* ]] \
-     && [[ $PREFIX = *--* ]]; then
-  #this match could be better
-    _baz_namespace_branches $(($1 - 1))
-  fi
-}
-
-(( $+functions[_baz_namespace_branches] )) ||
-_baz_namespace_branches () {
-  local suffix expl
-  if [ $1 -gt 1 ] || (( $trailing_dashes )); then
-    suffix=(-q -S --)
-  fi
-  if [[ $IPREFIX != *-- ]]; then
-    compset -P 1 '*--'
-    local category=${IPREFIX%--}
-    _description -V branches expl "${library:-}branches"
-    compadd $suffix "$expl[@]" \
-      ${${(@)$($BAZ ${library:-}branches $archive/$category)}##*--}
-  fi
-  if [ $1 -gt 1 ] && [[ $IPREFIX = *-- ]] && [[ $PREFIX = *--* ]]; then
-    _baz_namespace_versions $(($1 - 1))
-  fi
-}
-
-(( $+functions[_baz_namespace_versions] )) ||
-_baz_namespace_versions () {
-  local suffix expl
-  if [ $1 -gt 1 ]; then
-    suffix=(-q -S --)
-  fi
-  if [[ $IPREFIX != *--*-- ]] || [[ $IPREFIX != */*--*-- ]]; then
-    compset -P 1 '*--'
-    local branch=${IPREFIX%--}
-    _description -V versions expl "${library:-}versions"
-    compadd $suffix "$expl[@]" \
-      ${${(@)$($BAZ ${library:-}versions $archive/$branch)}##*--}
-  fi
-  if [ $1 -gt 1 ] && [[ $IPREFIX = *--*-- ]] && ([[ $IPREFIX = */*--*-- ]] \
-    || [[ $PREFIX != */* ]]) && [[ $PREFIX = *--* ]]; then
-    _baz_namespace_revisions
-  fi
-}
-
-(( $+functions[_baz_namespace_revisions] )) ||
-_baz_namespace_revisions () {
-  local expl
-  if [[ $IPREFIX != *--*--*-- ]] || [[ $IPREFIX != */*--*--*-- ]]; then
-    compset -P 1 '*--'
-    local version=${IPREFIX%--}
-    _description -V revisions expl "${library:-}revisions"
-    local completions c
-    completions=(
-      ${${(@)$($BAZ ${library:-}revisions $archive/$version)}##*--}
-    )
-    (( exclude_library_revisions )) && \
-        foreach c ($($BAZ library-revisions $archive/$version)); do completions[(r)$c]=(); done
-    compadd "$expl[@]" -a completions
-  fi
-}
-
 (( $+functions[_baz_config] )) ||
 _baz_config () {
   local configdir root ret=1 n expl
diff --git a/Completion/Unix/Command/_tla b/Completion/Unix/Command/_tla
index 0951cc749..876f9dcf3 100644
--- a/Completion/Unix/Command/_tla
+++ b/Completion/Unix/Command/_tla
@@ -23,30 +23,19 @@ fi
 # completion functions
 
 (( $+functions[_tla_archives] )) ||
-_tla_archives () {
-  local expl completions library name_arg='-n'
-  if [[ -n $argv[(r)--library] ]]; then
-    library='library-'
-    # remove parameter from $@ before calling compadd
-    argv[(r)--library]=()
-    name_arg=
-  fi
-  completions=($(_call_program tla $TLA ${library:-}archives $name_arg))
-  _description -V archives expl "${library:-}archives"
-  compadd "$@" "$expl[@]" -- "$completions[@]"
-}
+_tla_archives () { _arch_archives tla "$@" }
 
 (( $+functions[_tla_categories] )) ||
-_tla_categories () { _tla_namespace 1 "$argv[@]" }
+_tla_categories () { _arch_namespace tla 1 "$argv[@]" }
 
 (( $+functions[_tla_branches] )) ||
-_tla_branches () {_tla_namespace 2 "$argv[@]" }
+_tla_branches () {_arch_namespace tla 2 "$argv[@]" }
 
 (( $+functions[_tla_versions] )) ||
-_tla_versions () { _tla_namespace 3 "$argv[@]" }
+_tla_versions () { _arch_namespace tla 3 "$argv[@]" }
 
 (( $+functions[_tla_revisions] )) ||
-_tla_revisions () { _tla_namespace 4 "$argv[@]" }
+_tla_revisions () { _arch_namespace tla 4 "$argv[@]" }
 
 (( $+functions[_tla_local_revisions] )) ||
 _tla_local_revisions () {
@@ -59,102 +48,6 @@ _tla_local_revisions () {
   # Should complete based on -A, -R, -d
 }
 
-(( $+functions[_tla_namespace] )) ||
-_tla_namespace () { #double as arch_namespace_categories
-# takes an integer argument specifying how many components:
-# 1: category
-# 2: branch
-# 3: version
-# 4: revision
-  local suffix expl archive=`$TLA my-default-archive 2> /dev/null`
-  local trailing_dashes=0
-  [[ -n $argv[(r)--trailing-dashes] ]] && trailing_dashes=1
-  local library
-  [[ -n $argv[(r)--library] ]] && library='library-';
-  local exclude_library_revisions=0
-  [[ -n $argv[(r)--exclude-library-revisions] ]] && exclude_library_revisions=1
-
-  if [ $1 -gt 1 ] || (( trailing_dashes )); then
-    suffix=(-q -S --)
-  fi
-  if [[ $PREFIX = */* ]]; then
-    compset -P '*/'
-    archive=${IPREFIX%/*}
-    _description -V categories expl "${library:-}categories in $archive"
-    compadd $suffix "$expl[@]" `$TLA ${library:-}categories -A $archive`
-  elif [ -z $IPREFIX ]; then
-    local index=$(( words[(i)-A] + 1 ))
-    (( index < CURRENT )) || index=$(( words[(i)--archive] + 1 ))
-    (( index < CURRENT )) && archive=$words[$index]
-
-    if [ $archive ]; then
-      _description -V categories expl "${library:-}categories in $archive"
-      compadd "$expl[@]" $suffix `$TLA ${library:-}categories -A $archive`
-    fi
-
-    _tla_archives -S / ${library:+--library}
-  fi
-  if [ $archive ] && [ $1 -gt 1 ] && [[ $PREFIX != *@* ]] \
-     && [[ $PREFIX = *--* ]]; then
-  #this match could be better
-    _tla_namespace_branches $(($1 - 1))
-  fi
-}
-
-(( $+functions[_tla_namespace_branches] )) ||
-_tla_namespace_branches () {
-  local suffix expl
-  if [ $1 -gt 1 ] || (( $trailing_dashes )); then
-    suffix=(-q -S --)
-  fi
-  if [[ $IPREFIX != *-- ]]; then
-    compset -P 1 '*--'
-    local category=${IPREFIX%--}
-    _description -V branches expl "${library:-}branches"
-    compadd $suffix "$expl[@]" \
-      ${${(@)$($TLA ${library:-}branches -A $archive $category)}##*--}
-  fi
-  if [ $1 -gt 1 ] && [[ $IPREFIX = *-- ]] && [[ $PREFIX = *--* ]]; then
-    _tla_namespace_versions $(($1 - 1))
-  fi
-}
-
-(( $+functions[_tla_namespace_versions] )) ||
-_tla_namespace_versions () {
-  local suffix expl
-  if [ $1 -gt 1 ]; then
-    suffix=(-q -S --)
-  fi
-  if [[ $IPREFIX != *--*-- ]] || [[ $IPREFIX != */*--*-- ]]; then
-    compset -P 1 '*--'
-    local branch=${IPREFIX%--}
-    _description -V versions expl "${library:-}versions"
-    compadd $suffix "$expl[@]" \
-      ${${(@)$($TLA ${library:-}versions -A $archive $branch)}##*--}
-  fi
-  if [ $1 -gt 1 ] && [[ $IPREFIX = *--*-- ]] && ([[ $IPREFIX = */*--*-- ]] \
-    || [[ $PREFIX != */* ]]) && [[ $PREFIX = *--* ]]; then
-    _tla_namespace_revisions
-  fi
-}
-
-(( $+functions[_tla_namespace_revisions] )) ||
-_tla_namespace_revisions () {
-  local expl
-  if [[ $IPREFIX != *--*--*-- ]] || [[ $IPREFIX != */*--*--*-- ]]; then
-    compset -P 1 '*--'
-    local version=${IPREFIX%--}
-    _description -V revisions expl "${library:-}revisions"
-    local completions c
-    completions=(
-      ${${(@)$($TLA ${library:-}revisions -A $archive $version)}##*--}
-    )
-    (( exclude_library_revisions )) && \
-        foreach c ($($TLA library-revisions -A $archive $version)); do completions[(r)$c]=(); done
-    compadd "$expl[@]" -a completions
-  fi
-}
-
 (( $+functions[_tla_config] )) ||
 _tla_config () {