Commit 865a65ac authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-search: try to colorize output

parent 5ab18570
...@@ -79,14 +79,24 @@ docmd $CMD $string ...@@ -79,14 +79,24 @@ docmd $CMD $string
__epm_search_make_grep() __epm_search_make_grep()
{ {
local i local i
shift [ -z "$*" ] && return
local list=
local listN=
for i in $@ ; do for i in $@ ; do
local NOR=${i/^/} local NOR="${i/^/}"
if [ "$NOR" = "$i" ] ; then [ "$NOR" = "$i" ] && list="$list $NOR" || listN="$listN $NOR"
echo -n " | grep -- \"$i\"" done
else
echo -n " | grep -v -- \"$NOR\"" #list=$(strip_spaces $list | sed -e "s/ /|/g")
fi listN=$(strip_spaces $listN | sed -e "s/ /|/g")
[ -n "$listN" ] && echo -n " | egrep -i -v -- \"$listN\""
# FIXME: The World has not idea how to do grep both string
# http://stackoverflow.com/questions/10110051/grep-with-two-strings-logical-and-in-regex?rq=1
for i in $list ; do
echo -n " | egrep -i --color -- \"$i\""
done done
} }
...@@ -94,9 +104,9 @@ __epm_search_make_grep() ...@@ -94,9 +104,9 @@ __epm_search_make_grep()
epm_search() epm_search()
{ {
[ -n "$pkg_filenames" ] || fatal "Run search without any string" [ -n "$pkg_filenames" ] || fatal "Please, use search with some argument"
# FIXME: do it better # FIXME: do it better
local MGS=$(eval __epm_search_make_grep $quoted_args) local MGS=$(eval __epm_search_make_grep $quoted_args)
EXTRA_SHOWDOCMD=$MGS EXTRA_SHOWDOCMD="$MGS"
eval "__epm_search_output \"$(eval get_firstarg $quoted_args)\" $MGS" eval "__epm_search_output \"$(eval get_firstarg $quoted_args)\" $MGS"
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment