summaryrefslogtreecommitdiffstats
path: root/extra/source/bash-completion/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'extra/source/bash-completion/contrib')
-rw-r--r--extra/source/bash-completion/contrib/pkgtools127
-rw-r--r--extra/source/bash-completion/contrib/rpm2tgz14
-rw-r--r--extra/source/bash-completion/contrib/sbopkg76
-rw-r--r--extra/source/bash-completion/contrib/slackpkg95
-rw-r--r--extra/source/bash-completion/contrib/slapt136
5 files changed, 448 insertions, 0 deletions
diff --git a/extra/source/bash-completion/contrib/pkgtools b/extra/source/bash-completion/contrib/pkgtools
new file mode 100644
index 000000000..2b438efca
--- /dev/null
+++ b/extra/source/bash-completion/contrib/pkgtools
@@ -0,0 +1,127 @@
+# bash completion for Slackware Linux pkgtools
+
+[ -f /etc/slackware-version ] &&
+{
+
+have pkgtool &&
+_pkgtool()
+{
+ COMPREPLY=()
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--sets --ignore-tagfiles --tagfile \
+ --source-mounted --source_dir --target_dir --source_device' \
+ -- "$cur" ) )
+ return 0
+ fi
+
+ local prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ case $prev in
+ --source_dir|--target_dir)
+ _filedir -d
+ return 0
+ ;;
+ --sets)
+ # argument required but no completions available
+ return 0
+ ;;
+ --source_device)
+ COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) )
+ return 0
+ ;;
+ --tagfile)
+ _filedir
+ return 0
+ ;;
+ esac
+} &&
+complete -F _pkgtool pkgtool
+
+have removepkg &&
+_removepkg()
+{
+ COMPREPLY=()
+ local cur=`_get_cword`
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-copy -keep -preserve -warn' \
+ -- "$cur" ) )
+ return 0
+ fi
+
+ COMPREPLY=( $( cd /var/log/packages; compgen -f -- "$cur" ) )
+} &&
+complete -F _removepkg removepkg
+
+have upgradepkg &&
+_upgradepkg()
+{
+ COMPREPLY=()
+ local cur=`_get_cword`
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--dry-run --install-new --reinstall \
+ --verbose' -- "$cur") )
+ return 0
+ fi
+
+ _filedir "t[bglx]z"
+} && complete -F _upgradepkg upgradepkg
+
+have installpkg &&
+_installpkg()
+{
+ COMPREPLY=()
+ local cur=`_get_cword`
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--warn --md5sum --root --infobox --terse \
+ --menu --ask --priority --tagfile' -- "$cur") )
+ return 0
+ fi
+
+ local prev=`_get_pword`
+
+ case $prev in
+ --root)
+ _filedir -d
+ return 0
+ ;;
+ --priority)
+ COMPREPLY=( $( compgen -W 'ADD REC OPT SKP' -- "$cur" ) )
+ return 0
+ ;;
+ --tagfile)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ _filedir "t[bglx]z"
+} && complete -F _installpkg installpkg
+
+have makepkg &&
+_makepkg()
+{
+ COMPREPLY=()
+ local cur=`_get_cword`
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-l --linkadd -p --prepend \
+ -c --chown' -- "$cur") )
+ return 0
+ fi
+
+ local prev=`_get_pword`
+
+ case $prev in
+ -l|--linkadd|-c|--chown)
+ COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ _filedir
+} && complete -F _makepkg makepkg
+
+have explodepkg &&
+complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg
+
+}
diff --git a/extra/source/bash-completion/contrib/rpm2tgz b/extra/source/bash-completion/contrib/rpm2tgz
new file mode 100644
index 000000000..23c70ac9f
--- /dev/null
+++ b/extra/source/bash-completion/contrib/rpm2tgz
@@ -0,0 +1,14 @@
+# Slackware rpm2tgz completion.
+
+have rpm2tgz &&
+_rpm2tgz()
+{
+ COMPREPLY=()
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-s -S -n -r -d -c' -- "$cur" ) )
+ return 0
+ fi
+
+ COMPREPLY=( $(compgen -f -X "!*.rpm" -- "$cur") )
+} && complete -F _rpm2tgz -o plusdirs rpm2tgz rpm2txz rpm2targz
diff --git a/extra/source/bash-completion/contrib/sbopkg b/extra/source/bash-completion/contrib/sbopkg
new file mode 100644
index 000000000..698fdf18d
--- /dev/null
+++ b/extra/source/bash-completion/contrib/sbopkg
@@ -0,0 +1,76 @@
+# bash completion for sbopkg tool
+
+have sbopkg &&
+_sbopkg()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ 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
+
+ case $prev in
+ -e)
+ COMPREPLY=( $( compgen -W 'ask continue stop' -- "$cur" ) )
+ return 0
+ ;;
+ -f)
+ _filedir
+ return 0
+ ;;
+ -d)
+ _filedir -d
+ return 0
+ ;;
+ -V)
+ COMPREPLY=( $( compgen -W "? \
+ $(sbopkg -V ? 2>&1 | cut -s -f1)" -- "$cur" ) )
+ return 0
+ ;;
+ -i|-b)
+ ;;
+ *)
+ return 0
+ ;;
+ esac
+
+ local config="/etc/sbopkg/sbopkg.conf"
+ local words
+ _get_comp_words_by_ref words
+
+ for (( i=${#words[@]}-1; i>0; i-- )); do
+ if [[ "${words[i]}" == -f ]]; then
+ config="${words[i+1]}"
+ break
+ fi
+ done
+
+ if [ ! -r "$config" ]; then
+ return 0
+ fi
+
+ . $config
+
+ for (( i=1; i<${#words[@]}; i++ )); do
+ case "${words[i]}" in
+ -V)
+ REPO_NAME="${words[i+1]%%/*}"
+ REPO_BRANCH="${words[i+1]#*/}"
+ ;;
+ -d)
+ REPO_ROOT="${words[i+1]}"
+ ;;
+ esac
+ done
+
+ if [ ! -r "$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT" ]; then
+ return 0
+ 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" ) )
+} && complete -F _sbopkg sbopkg
diff --git a/extra/source/bash-completion/contrib/slackpkg b/extra/source/bash-completion/contrib/slackpkg
new file mode 100644
index 000000000..139e7edd7
--- /dev/null
+++ b/extra/source/bash-completion/contrib/slackpkg
@@ -0,0 +1,95 @@
+# bash completion for slackpkg tool
+
+have slackpkg &&
+_slackpkg()
+{
+ COMPREPLY=()
+ local cur
+ _get_comp_words_by_ref cur
+
+ # based on `grep '\-.*\=.*)' /usr/sbin/slackpkg | cut -f1 -d\)`
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-delall=on -delall=off \
+ -checkmd5=on -checkmd5=off \
+ -checkgpg=on -checkgpg=off \
+ -checksize=on -checksize=off \
+ -postinst=on -postinst=off \
+ -onoff=on -onoff=off \
+ -download_all=on -download_all=off \
+ -dialog=on -dialog=off \
+ -dialog_maxargs= \
+ -batch=on -batch=off \
+ -only_new_dotnew=on -only_new_dotnew=off \
+ -use_includes=on -use_includes=off \
+ -spinning=on -spinning=off \
+ -default_answer=yes -default_answer=no \
+ -mirror=' -- "$cur" ) )
+ return 0
+ fi
+
+ local confdir="/etc/slackpkg"
+ local config="$confdir/slackpkg.conf"
+
+ if [ ! -r "$config" ]; then
+ return 0
+ fi
+ . "$config"
+
+ local action words
+ _get_comp_words_by_ref -n "=" words
+
+ for (( i=1; i<${#words[@]}; i++ )); do
+ if [[ "${words[i]}" != -* ]]; then
+ action="${words[i]}"
+ break
+ fi
+ done
+
+ case $action in
+ generate-template|search|file-search)
+ # argument required but no completions available
+ return 0
+ ;;
+ install-template|remove-template)
+ if [ -e "$confdir/templates" ]; then
+ COMPREPLY=( $( cd "$confdir/templates"; \
+ compgen -f -X "!*.template" -- "$cur" ) )
+ COMPREPLY=( ${COMPREPLY[@]%.template} )
+ fi
+ return 0
+ ;;
+ remove)
+ _filedir
+ COMPREPLY+=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x \
+ xap y' -- "$cur" ) )
+ COMPREPLY+=( $( cd /var/log/packages; compgen -f -- "$cur" ) )
+ return 0
+ ;;
+ install|reinstall|upgrade|blacklist|download)
+ _filedir
+ COMPREPLY+=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x \
+ xap y' -- "$cur" ) )
+ COMPREPLY+=( $( cut -f 6 -d\ ${WORKDIR}/pkglist 2> /dev/null | \
+ grep "^$cur" ) )
+ return 0
+ ;;
+ info)
+ COMPREPLY+=( $( cut -f 6 -d\ ${WORKDIR}/pkglist 2> /dev/null | \
+ grep "^$cur" ) )
+ return 0
+ ;;
+ update)
+ # we should complete the same as the next `list` + "gpg"
+ COMPREPLY=( $( compgen -W 'gpg' -- "$cur" ) )
+ ;&
+ *)
+ COMPREPLY+=( $( compgen -W 'install reinstall upgrade remove \
+ blacklist download update install-new upgrade-all \
+ clean-system new-config check-updates help generate-template \
+ install-template remove-template search file-search info' -- \
+ "$cur" ) )
+ return 0
+ ;;
+ esac
+
+} && complete -F _slackpkg slackpkg
diff --git a/extra/source/bash-completion/contrib/slapt b/extra/source/bash-completion/contrib/slapt
new file mode 100644
index 000000000..779465388
--- /dev/null
+++ b/extra/source/bash-completion/contrib/slapt
@@ -0,0 +1,136 @@
+# slapt-get and slapt-src completion
+
+have slapt-get &&
+_slapt_get()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--download-only -d --simulate -s \
+ --no-prompt -y --prompt -p --reinstall --ignore-excludes \
+ --no-md5 --ignore-dep --no-dep --print-uris --show-stats -S \
+ --config -c --remove-obsolete --retry --no-upgrade \
+ --update -u --upgrade --dist-upgrade --install -i --install-set \
+ --remove --show --filelist --search --list --available \
+ --installed --clean --autoclean --add-keys \
+ --version --help -h' -- "$cur" ) )
+ return 0
+ fi
+
+ case $prev in
+ --config|-c)
+ _filedir
+ return 0
+ ;;
+ --retry|--search)
+ # argument required but no completions available
+ return 0
+ ;;
+ esac
+
+ local words t
+ _get_comp_words_by_ref words
+
+ # search for last action (--install|--install-set|--remove|--show|--filelist)
+ for (( i=${#words[@]}-1; i>0; i-- )); do
+ if [[ ${words[i]} == -@(i|-install|-show) ]]; then
+ t="all"
+ break
+ elif [[ ${words[i]} == --install-set ]]; then
+ t="set"
+ break
+ elif [[ ${words[i]} == --@(remove|filelist) ]]; then
+ t="ins"
+ break
+ fi
+ done
+
+ case $t in
+ all) # --install|-i|--show
+ # slapt-get will fail to search for "^name-version"
+ # it can search for names only
+ local name=$( echo $cur | cut -f1 -d- )
+ COMPREPLY=( $( slapt-get --search "^$name" 2> /dev/null | \
+ sed -ne "/^$cur/{s/ .*$//;p}" ) )
+ return 0
+ ;;
+ ins) # --remove|--filelist
+ COMPREPLY=( $( cd /var/log/packages; compgen -f -- "$cur" ) )
+ return 0
+ ;;
+ set) # --install-set
+ COMPREPLY=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x \
+ xap y' -- "$cur" ) )
+ return 0
+ ;;
+ esac
+} && complete -F _slapt_get slapt-get
+
+have slapt-src &&
+_slapt_src()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--update -u --list -l --clean -e \
+ --search -s --show -w --install -i --build -b --fetch -f \
+ --yes -y --config -c --no-dep -n --postprocess -p \
+ --version -v --help -h' -- "$cur" ) )
+ return 0
+ fi
+
+ case $prev in
+ --config|-c)
+ _filedir
+ return 0
+ ;;
+ --search|-s|--postprocess|-p)
+ # argument required but no completions available
+ return 0
+ ;;
+ esac
+
+ local words
+ _get_comp_words_by_ref words
+
+ local t
+ # search for last action (-i|-w|-b|-f)
+ for (( i=${#words[@]}-1; i>0; i-- )); do
+ if [[ ${words[i]} == -@(i|w|f|b|-install|-show|-build|-fetch) ]]; then
+ t="all"
+ break
+ fi
+ done
+ if [ "$t" != "all" ]; then
+ return 0
+ fi
+
+ local config="/etc/slapt-get/slapt-srcrc" # default config location
+ # search for config
+ for (( i=${#words[@]}-1; i>0; i-- )); do
+ if [[ ${words[i]} == -@(c|-config) ]]; then
+ config="${words[i+1]}"
+ break
+ fi
+ done
+ if [ ! -r "$config" ]; then
+ return 0
+ fi
+
+ local builddir=$( sed -ne "/^BUILDDIR=/{s/^BUILDDIR=//;p}" "$config" )
+ if [ ! -d "$builddir" ]; then
+ return 0
+ fi
+
+ local slck_data="${builddir}/slackbuilds_data"
+ if [ ! -r "$slck_data" ]; then
+ return 0
+ fi
+
+ COMPREPLY=( $( sed -ne \
+ "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}" "$slck_data" ) )
+} && complete -F _slapt_src slapt-src