[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-235-g26ae770
Igor Murzov
igor at gplsoft.org
Mon May 2 10:27:52 UTC 2011
The following commit has been merged in the master branch:
commit b34617469777de05257d86b3810578b3ac4ca97f
Author: Igor Murzov <igor at gplsoft.org>
Date: Tue Jan 25 03:48:34 2011 +0300
Overall clean up of different slackware-specific completions
Redundant braces removed; less grep + cut more sed; minor bugs fixed;
diff --git a/completions/pkgtools b/completions/pkgtools
index 60a2d92..b554179 100644
--- a/completions/pkgtools
+++ b/completions/pkgtools
@@ -49,9 +49,9 @@ _removepkg()
return 0
fi
- COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) )
+ COMPREPLY=( $( cd /var/log/packages; compgen -f -- "$cur" ) )
} &&
-complete -F _removepkg -o filenames removepkg
+complete -F _removepkg removepkg
have upgradepkg &&
_upgradepkg()
@@ -64,8 +64,8 @@ _upgradepkg()
return 0
fi
- COMPREPLY=( $(compgen -f -X "!*.t[bglx]z" -- "$cur") )
-} && complete -F _upgradepkg -o plusdirs upgradepkg
+ _filedir "t[bglx]z"
+} && complete -F _upgradepkg upgradepkg
have installpkg &&
_installpkg()
@@ -95,9 +95,8 @@ _installpkg()
;;
esac
- COMPREPLY=( $(compgen -f -X "!*.t[bglx]z" -- "$cur") \
- $(compgen -d -- "$cur") )
-} && complete -F _installpkg -o filenames installpkg
+ _filedir "t[bglx]z"
+} && complete -F _installpkg installpkg
have makepkg &&
_makepkg()
@@ -113,24 +112,16 @@ _makepkg()
local prev=`_get_pword`
case $prev in
- -l|-l|-c|--chown)
+ -l|--linkadd|-c|--chown)
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
return 0
;;
esac
_filedir
-} && complete -F _makepkg -o filenames makepkg
+} && complete -F _makepkg makepkg
have explodepkg &&
complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg
}
-
-# Local variables:
-# mode: shell-script
-# sh-basic-offset: 4
-# sh-indent-comment: t
-# indent-tabs-mode: nil
-# End:
-# ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/sbopkg b/completions/sbopkg
index dcdc330..698fdf1 100644
--- a/completions/sbopkg
+++ b/completions/sbopkg
@@ -70,7 +70,7 @@ _sbopkg()
if [ ! -r "$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT" ]; then
return 0
fi
- COMPREPLY=( $( grep "^SLACKBUILD NAME: $cur" \
- $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT | cut -f3- -d\ )
- $( (cd $QUEUEDIR; ls $cur*.sqf 2> /dev/null) ) )
-} && complete -F _sbopkg -o plusdirs sbopkg
+ 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/completions/slackpkg b/completions/slackpkg
index d9bf811..b9263fe 100644
--- a/completions/slackpkg
+++ b/completions/slackpkg
@@ -22,8 +22,7 @@ _slackpkg()
-only_new_dotnew=on -only_new_dotnew=off \
-use_includes=on -use_includes=off \
-spinning=on -spinning=off \
- -default_answer=y -default_answer=yes \
- -default_answer=n -default_answer=no \
+ -default_answer=yes -default_answer=no \
-mirror=' -- "$cur" ) )
return 0
fi
@@ -43,8 +42,9 @@ _slackpkg()
;;
install-template|remove-template)
if [ -e "$confdir/templates" ]; then
- COMPREPLY=( $( (cd "$confdir/templates"; \
- ls *.template 2>/dev/null | sed 's/.template$//g' ) ) )
+ COMPREPLY=( $( cd "$confdir/templates"; \
+ compgen -f -X "!*.template" -- "$cur" ) )
+ COMPREPLY=( ${COMPREPLY[@]%.template} )
fi
return 0
;;
@@ -52,22 +52,22 @@ _slackpkg()
_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") ) )
+ 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+=( $( grep "^PACKAGE NAME: *$cur" \
- "${WORKDIR}/PACKAGES.TXT" 2>/dev/null | \
- sed 's/^PACKAGE NAME: *//g' ) )
+ COMPREPLY+=( $( sed -ne \
+ "/^PACKAGE NAME: *$cur/{s/^PACKAGE NAME: *//;p}" \
+ "${WORKDIR}/PACKAGES.TXT" 2>/dev/null ) )
return 0
;;
info)
- COMPREPLY=( $( grep "^PACKAGE NAME: *$cur" \
- "${WORKDIR}/PACKAGES.TXT" 2>/dev/null | \
- sed 's/^PACKAGE NAME: *//g' ) )
+ COMPREPLY=( $( sed -ne \
+ "/^PACKAGE NAME: *$cur/{s/^PACKAGE NAME: *//;p}" \
+ "${WORKDIR}/PACKAGES.TXT" 2>/dev/null ) )
return 0
;;
update)
diff --git a/completions/slapt b/completions/slapt
index e821cc9..033accf 100644
--- a/completions/slapt
+++ b/completions/slapt
@@ -49,15 +49,15 @@ _slapt-get()
case $t in
all) # --install|-i|--show
- # slapt-get will fail to search for "^orc-0.4.4" for example
- # it can only search for names, so we should anything else
+ # 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 | \
- awk '{print $1}' | grep "^$cur" ) )
+ sed -ne "/^$cur/{s/ .*$//;p}" ) )
return 0
;;
ins) # --remove|--filelist
- COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) )
+ COMPREPLY=( $( cd /var/log/packages; compgen -f -- "$cur" ) )
return 0
;;
set) # --install-set
@@ -121,7 +121,7 @@ _slapt-src()
return 0
fi
- local builddir=$( grep '^BUILDDIR=' "$config" | cut -f2 -d\= )
+ local builddir=$( sed -ne "/^BUILDDIR=/{s/^BUILDDIR=//;p}" "$config" )
if [ ! -d "$builddir" ]; then
return 0
fi
@@ -131,5 +131,6 @@ _slapt-src()
return 0
fi
- COMPREPLY=( $( grep "^SLACKBUILD NAME: $cur" "$slck_data" | cut -f3- -d\ ) )
+ COMPREPLY=( $( sed -ne \
+ "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}" "$slck_data" ) )
} && complete -F _slapt-src slapt-src
--
bash-completion
More information about the Bash-completion-commits
mailing list