[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-235-g26ae770
Sergey V
sftp.mtuci at gmail.com
Mon May 2 10:27:37 UTC 2011
The following commit has been merged in the master branch:
commit 66b0cd72af4b35534c7fbe71a6d1a68ff795a758
Author: Sergey V <sftp.mtuci at gmail.com>
Date: Fri Nov 5 18:14:01 2010 +0300
slackware: update sbopkg completion
diff --git a/completions/slackware b/completions/slackware
index 4a28fad..ca45b4a 100644
--- a/completions/slackware
+++ b/completions/slackware
@@ -157,48 +157,54 @@ _sbopkg()
local cur prev
_get_comp_words_by_ref cur prev
- case $prev in
- -f)
- _filedir
- return 0
- ;;
- -s|-g)
- return 0
- ;;
- -V)
- COMPREPLY='?'
- return 0;
- ;;
- -i|-b)
- COMPREPLY=( $( grep "^SLACKBUILD NAME: $cur" \
- /var/lib/sbopkg/SBo/13.1/SLACKBUILDS.TXT | cut -f3- -d\ ) )
- return 0
- ;;
- esac
+ if [[ "$cur" == --* ]]; then
+ COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
+ return 0
+ fi
- local config=/etc/sbopkg/sbopkg.conf
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b -c -d -e -f -g -h -i -k -l \
+ -o -P -p -q -R -r -s -u -V -v' -- "$cur" ) )
+ return 0
+ fi
+ local config=/etc/sbopkg/sbopkg.conf
for (( i=${#words[@]}-1; i>0; i-- )); do
if [[ ${words[i]} == '-f' ]]; then
config="${words[i+1]}"
- break
fi
done
+
+ if [ -e $config ]; then
+ . $config
+ fi
if [ ! -r "$config" ]; then
return 0
fi
+
+ for (( i=${#words[@]}-1; i>0; i-- )); do
+ if [[ ${words[i]} == '-V' ]]; then
+ REPO_NAME=`echo ${words[i+1]} | cut -f1 -d/`
+ REPO_BRANCH=`echo ${words[i+1]} | cut -f2 -d/`
+ fi
+ done
- if [[ "$cur" == --* ]]; then
- COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
- return 0
- fi
+ case $prev in
+ -f)
+ _filedir
+ return 0
+ ;;
+ -s|-g|-V)
+ return 0
+ ;;
+ -i|-b)
+ COMPREPLY=( $( grep "^SLACKBUILD NAME: $cur" \
+ $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT | cut -f3- -d\ ) )
+ return 0
+ ;;
+ esac
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b -c -d -e -f -g -h -i -k -l \
- -o -P -p -q -R -r -s -u -V -v' -- "$cur" ) )
- return 0
- fi
} && complete -F _sbopkg sbopkg -o plusdirs
}
--
bash-completion
More information about the Bash-completion-commits
mailing list