From c7e79304b8a5e88e1958f54eadc998216c8a102d Mon Sep 17 00:00:00 2001 From: Matteo Rossini Date: Sat, 27 Feb 2016 15:34:00 +0100 Subject: [PATCH] Added WW_FILE_SEARCH --- src/README | 13 +++++++++++++ src/slackpkgplus.sh | 7 +++++-- src/slackpkgplus.x86.sample | 4 ++++ src/slackpkgplus.x86_64.sample | 4 ++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/README b/src/README index 8658c0a..6f74388 100644 --- a/src/README +++ b/src/README @@ -499,6 +499,19 @@ may take a very lot of time! ----- +WW_FILE_SEARCH + +By default 'slackpkg file-search' search whole words, so +# slackpkg file-search slackpkgpl +returns nothing. + +By setting WW_FILE_SEARCH to on, the same command should find slackpkg+ +becouse match slackpkgplus.conf and other. + +Note that a short pattern may match many many packages. + +----- + SHOWORDER By default slackpkg in dialogbox sort packages by name. diff --git a/src/slackpkgplus.sh b/src/slackpkgplus.sh index 3005aa3..4460736 100755 --- a/src/slackpkgplus.sh +++ b/src/slackpkgplus.sh @@ -27,6 +27,7 @@ if [ -e $CONF/slackpkgplus.conf ];then EXTDOWNLOADONLY=$DOWNLOADONLY EXTSTRICTGPG=$STRICTGPG EXTDETAILED_INFO=$DETAILED_INFO + EXTWW_FILE_SEARCH=$WW_FILE_SEARCH . $CONF/slackpkgplus.conf @@ -43,6 +44,7 @@ if [ -e $CONF/slackpkgplus.conf ];then DOWNLOADONLY=${EXTDOWNLOADONLY:-$DOWNLOADONLY} STRICTGPG=${EXTSTRICTGPG:-$STRICTGPG} DETAILED_INFO=${EXTDETAILED_INFO:-$DETAILED_INFO} + WW_FILE_SEARCH=${EXTWW_FILE_SEARCH:-$WW_FILE_SEARCH} USEBLACKLIST=true if [ "$USEBL" == "0" ];then @@ -890,6 +892,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then [ "$SPINNING" = "off" ] || spinning ${TMPDIR}/waiting & [ "$SENSITIVE_SEARCH" = "off" ] && GREPOPTS="--ignore-case" + [ ! "$WW_FILE_SEARCH" = "off" ] && GREPOPTS="$GREPOPTS --word-regexp" # -- PKGLIST: # temporary file used to store data about packages. It uses @@ -914,7 +917,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then # for the fields: version(3) arch(4) build(5), path(7), # extension(8) # - zegrep ${GREPOPTS} -w "${SEARCHSTR}" ${WORKDIR}/${DIR}-filelist.gz | \ + zegrep ${GREPOPTS} "${SEARCHSTR}" ${WORKDIR}/${DIR}-filelist.gz | \ cut -d" " -f 1 | rev | cut -f2- -d"." | cut -f1 -d"/" | rev |\ awk '{ l_pname=$0 @@ -1636,7 +1639,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then fi # "$CMD" == "install" / "upgrade" / "reinstall" / "remove" if [ "$CMD" == "search" ] || [ "$CMD" == "file-search" ] ; then - PATTERN=$(echo $ARG | sed -e 's/\+/\\\+/g' -e 's/\./\\\./g' -e 's/ /\|/g') + PATTERN=$(echo $ARG | sed -e 's/\+/\\\+/g' -e 's/\./\\\./g' -e 's/ /\|/g' -e 's/^\///') searchPackages $PATTERN case $CMD in diff --git a/src/slackpkgplus.x86.sample b/src/slackpkgplus.x86.sample index 34cf89a..0896563 100644 --- a/src/slackpkgplus.x86.sample +++ b/src/slackpkgplus.x86.sample @@ -39,6 +39,10 @@ GREYLIST=on # Defines if commands 'search' and 'file-search' are case-sensitive (on) or not (off). Default to "on" SENSITIVE_SEARCH=on +# Defines if command 'file-search' does search Wole Word (on) of accept partial words (off). Note that +# you may obtains many many results searching a short partial word +WW_FILE_SEARCH=on + # Select the show order in dialogbox. Available "package" "repository" "tag" "path" "arch" SHOWORDER=package diff --git a/src/slackpkgplus.x86_64.sample b/src/slackpkgplus.x86_64.sample index 12dd15b..3cce2bc 100644 --- a/src/slackpkgplus.x86_64.sample +++ b/src/slackpkgplus.x86_64.sample @@ -47,6 +47,10 @@ GREYLIST=on # Defines if commands 'search' and 'file-search' are case-sensitive (on) or not (off). Default to "on" SENSITIVE_SEARCH=on +# Defines if command 'file-search' does search Wole Word (on) of accept partial words (off). Note that +# you may obtains many many results searching a short partial word +WW_FILE_SEARCH=on + # Select the show order in dialogbox. Available "package" "repository" "tag" "path" "arch" SHOWORDER=package