Skip to content

Commit

Permalink
Improved "query"
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
ivan-hc authored Jan 19, 2022
1 parent 5bf41a9 commit c172b28
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions APP-MANAGER
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit c172b28

Please sign in to comment.