Commit 58842d6a authored by Vitaly Lipatov's avatar Vitaly Lipatov

colorify search_file

parent a0b1fb81
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2016 Etersoft # Copyright (C) 2012-2017 Etersoft
# Copyright (C) 2012-2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2017 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2016 Etersoft # Copyright (C) 2012, 2016, 2017 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016, 2017 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -17,10 +17,19 @@ ...@@ -17,10 +17,19 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# TODO: see epm-search (colorify for all distro)
# args: index_lists word grep_string
__alt_search_file_output()
{
# grep only on left part (filename), then revert order and grep with color
__local_ercat $1 | grep -h -- ".*$2.*[[:space:]]" | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g" $3
}
__alt_local_content_search() __alt_local_content_search()
{ {
load_helper epm-sh-altlinux load_helper epm-sh-altlinux
load_helper epm-search
info "Locate contents index file(s) ..." info "Locate contents index file(s) ..."
local CI="$(get_local_alt_contents_index)" local CI="$(get_local_alt_contents_index)"
...@@ -30,13 +39,12 @@ __alt_local_content_search() ...@@ -30,13 +39,12 @@ __alt_local_content_search()
info "Searching in" info "Searching in"
echo "$CI" echo "$CI"
echo "for $1... " echo "for $1... "
#[ -n "$USETTY" ] || OUTCMD="cat"
# OUTCMD="cat"
# { # FIXME: do it better
# note! tabulation below! local MGS
__local_ercat $CI | grep -h -- ".*$1.* " | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g" MGS=$(eval __epm_search_make_grep $quoted_args)
# } | $OUTCMD showcmd "$ cat contents_index $MGS"
eval "__alt_search_file_output \"$CI\" \"$(eval get_firstarg $quoted_args)\" $MGS"
} }
epm_search_file() epm_search_file()
...@@ -60,7 +68,7 @@ case $PMTYPE in ...@@ -60,7 +68,7 @@ case $PMTYPE in
;; ;;
dnf-rpm) dnf-rpm)
# TODO # TODO
info "Search by full packages list i snot implemented yet" info "Search by full packages list is not implemented yet"
CMD="dnf provides" CMD="dnf provides"
;; ;;
urpm-rpm) urpm-rpm)
......
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