sbopkg, slackpkg, slapt-{get,src}: Use shorter form of the check if file exists.

Also add information about corresponding man pages.
master
Igor Murzov 2012-01-12 19:54:06 +04:00
parent 32e8f33018
commit 33883145af
5 changed files with 15 additions and 20 deletions

View File

@ -1,4 +1,4 @@
# bash completion for sbopkg tool -*- shell-script -*-
# bash completion for sbopkg(8) -*- shell-script -*-
_sbopkg()
{
@ -44,10 +44,7 @@ _sbopkg()
fi
done
if [[ ! -r "$config" ]]; then
return
fi
[[ -r "$config" ]] || return
. $config
for (( i=1; i<${#words[@]}; i++ )); do
@ -61,10 +58,8 @@ _sbopkg()
;;
esac
done
[[ -r $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT ]] || return
if [[ ! -r $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT ]]; then
return
fi
COMPREPLY=( $( sed -ne "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}"\
$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT )
$( cd $QUEUEDIR; compgen -f -X "!*.sqf" -- "$cur" ) )

View File

@ -1,4 +1,4 @@
# bash completion for slackpkg tool -*- shell-script -*-
# bash completion for slackpkg(8) -*- shell-script -*-
# options list is based on `grep '\-.*\=.*)' /usr/sbin/slackpkg | cut -f1 -d\)`
_slackpkg()
@ -43,9 +43,7 @@ _slackpkg()
local confdir="/etc/slackpkg"
local config="$confdir/slackpkg.conf"
if [[ ! -r "$config" ]]; then
return
fi
[[ -r "$config" ]] || return
. "$config"
local i action

View File

@ -1,4 +1,4 @@
# slapt-get completion -*- shell-script -*-
# slapt-get(8) completion -*- shell-script -*-
_slapt_get()
{
@ -48,9 +48,7 @@ _slapt_get()
break
fi
done
if [[ ! -r "$config" ]]; then
return
fi
[[ -r "$config" ]] || return
case $t in
all) # --show

View File

@ -1,4 +1,4 @@
# slapt-src completion -*- shell-script -*-
# slapt-src(8) completion -*- shell-script -*-
_slapt_src()
{
@ -42,9 +42,7 @@ _slapt_src()
break
fi
done
if [[ ! -r "$config" ]]; then
return
fi
[[ -r "$config" ]] || return
if [[ "$cur" == *:* ]]; then
local name=${cur%:*}

View File

@ -24,6 +24,12 @@ assert_complete "--update --upgrade" "slapt-get --up" $test
sync_after_int
set test "--install should not complete anything if config doesn't exist"
assert_no_complete "slapt-get -c non-existent-file --install " $test
sync_after_int
set test "--install should complete available packages"
set config $::srcdir/fixtures/slackware/etc/slapt-get/slapt-getrc