From c172b289a5caccd05079e4e92731ef2e54ae8d0b Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Wed, 19 Jan 2022 16:21:58 +0100 Subject: [PATCH] Improved "query" Now the "am -q" command returns the lines containing the exact phrase you are looking for, searching for a specific application is now much easier and faster! --- APP-MANAGER | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/APP-MANAGER b/APP-MANAGER index 9e0a068fc..2db4ed3be 100644 --- a/APP-MANAGER +++ b/APP-MANAGER @@ -181,13 +181,17 @@ case "$1" in echo $(echo "ALL:"; grep -e "$" -c /opt/am/.cache/$arch-apps); echo $(echo "INSTALLED:"; cd /opt && find -name 'remove' -printf "%h\n" | sort -u | wc -l); echo "";; '-q'|'query') + ARGS=$(echo "$@" | sed 's/-q //') + echo "" + echo ' Search results for "'$ARGS'" in the list of available programs:' | tr a-z A-Z + echo "" while [ -n "$1" ] do case $2 in - *) for var in $2; + *) for var in $ARGS; do rm -R -f /opt/am/.cache/$arch-apps; cd /opt/am/.cache; wget -q $URL/programs/$arch-apps; - echo "" && echo ' SEARCH RESULTS FOR "'$2'" IN THE LIST OF AVAILABLE PROGRAMS:' && echo "" && grep -i -E $2 /opt/am/.cache/$arch-apps; echo ""; + grep -i -E "$ARGS" /opt/am/.cache/$arch-apps && echo "" && exit; done esac shift @@ -310,6 +314,6 @@ case "$1" in fi done shift;; - 'version'|'-v'|'--version') echo "2.1.5";; + 'version'|'-v'|'--version') echo "2.2.0";; *) exec /opt/am/APP-MANAGER ;; esac