Added WW_FILE_SEARCH

This commit is contained in:
Matteo Rossini 2016-02-27 15:34:00 +01:00
parent bb31ee5822
commit c7e79304b8
4 changed files with 26 additions and 2 deletions

View file

@ -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 SHOWORDER
By default slackpkg in dialogbox sort packages by name. By default slackpkg in dialogbox sort packages by name.

View file

@ -27,6 +27,7 @@ if [ -e $CONF/slackpkgplus.conf ];then
EXTDOWNLOADONLY=$DOWNLOADONLY EXTDOWNLOADONLY=$DOWNLOADONLY
EXTSTRICTGPG=$STRICTGPG EXTSTRICTGPG=$STRICTGPG
EXTDETAILED_INFO=$DETAILED_INFO EXTDETAILED_INFO=$DETAILED_INFO
EXTWW_FILE_SEARCH=$WW_FILE_SEARCH
. $CONF/slackpkgplus.conf . $CONF/slackpkgplus.conf
@ -43,6 +44,7 @@ if [ -e $CONF/slackpkgplus.conf ];then
DOWNLOADONLY=${EXTDOWNLOADONLY:-$DOWNLOADONLY} DOWNLOADONLY=${EXTDOWNLOADONLY:-$DOWNLOADONLY}
STRICTGPG=${EXTSTRICTGPG:-$STRICTGPG} STRICTGPG=${EXTSTRICTGPG:-$STRICTGPG}
DETAILED_INFO=${EXTDETAILED_INFO:-$DETAILED_INFO} DETAILED_INFO=${EXTDETAILED_INFO:-$DETAILED_INFO}
WW_FILE_SEARCH=${EXTWW_FILE_SEARCH:-$WW_FILE_SEARCH}
USEBLACKLIST=true USEBLACKLIST=true
if [ "$USEBL" == "0" ];then if [ "$USEBL" == "0" ];then
@ -890,6 +892,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
[ "$SPINNING" = "off" ] || spinning ${TMPDIR}/waiting & [ "$SPINNING" = "off" ] || spinning ${TMPDIR}/waiting &
[ "$SENSITIVE_SEARCH" = "off" ] && GREPOPTS="--ignore-case" [ "$SENSITIVE_SEARCH" = "off" ] && GREPOPTS="--ignore-case"
[ ! "$WW_FILE_SEARCH" = "off" ] && GREPOPTS="$GREPOPTS --word-regexp"
# -- PKGLIST: # -- PKGLIST:
# temporary file used to store data about packages. It uses # 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), # for the fields: version(3) arch(4) build(5), path(7),
# extension(8) # 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 |\ cut -d" " -f 1 | rev | cut -f2- -d"." | cut -f1 -d"/" | rev |\
awk '{ awk '{
l_pname=$0 l_pname=$0
@ -1636,7 +1639,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
fi # "$CMD" == "install" / "upgrade" / "reinstall" / "remove" fi # "$CMD" == "install" / "upgrade" / "reinstall" / "remove"
if [ "$CMD" == "search" ] || [ "$CMD" == "file-search" ] ; then 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 searchPackages $PATTERN
case $CMD in case $CMD in

View file

@ -39,6 +39,10 @@ GREYLIST=on
# Defines if commands 'search' and 'file-search' are case-sensitive (on) or not (off). Default to "on" # Defines if commands 'search' and 'file-search' are case-sensitive (on) or not (off). Default to "on"
SENSITIVE_SEARCH=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" # Select the show order in dialogbox. Available "package" "repository" "tag" "path" "arch"
SHOWORDER=package SHOWORDER=package

View file

@ -47,6 +47,10 @@ GREYLIST=on
# Defines if commands 'search' and 'file-search' are case-sensitive (on) or not (off). Default to "on" # Defines if commands 'search' and 'file-search' are case-sensitive (on) or not (off). Default to "on"
SENSITIVE_SEARCH=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" # Select the show order in dialogbox. Available "package" "repository" "tag" "path" "arch"
SHOWORDER=package SHOWORDER=package