Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

database.am Add colors to list #841

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions modules/database.am
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,21 @@ _about_download_lib() {

_pretty_list() {
# Remove references to URLs, "-a" elements in "-l" and "-q"
sed -E 's#(http|https|ftp)://[^ ]*##g; s#(SITE|SOURCE):##g; s/^/\n/g' | fold -sw 75 | sed 's/^/ /g; s/ ◆ /◆ /g'
sed -E 's#(http|https|ftp)://[^ ]*##g; s#(SITE|SOURCE):##g; s/^/\n/g' \
| _colors | fold -sw 75 | sed 's/^/ /g; s/ ◆ /◆ /g; s/ */ /g'
}

_pretty_list_compat() {
# Remove references to URLs, "-a" elements in "-l" and "-q"
sed -E 's#(http|https|ftp)://[^ ]*##g; s#(SITE|SOURCE):##g' | fold -sw 75 | sed 's/^/ /g; s/ ◆ /◆ /g'
sed -E 's#(http|https|ftp)://[^ ]*##g; s#(SITE|SOURCE):##g' \
| _colors | fold -sw 75 | sed 's/^/ /g; s/ ◆ /◆ /g; s/ */ /g'
}

_colors() {
awk '{
printf "%s \033[32m%s\033[0m", $1, $2
{$1 = ""; $2 = ""; print $0;}
}'
}

_list() {
Expand Down Expand Up @@ -152,10 +161,10 @@ case "$1" in
if [ "$2" = --appimages ]; then
_list_appimages
LIST=$(sort "$AMCACHEDIR/$arch-appimages" | _pretty_list)
printf "\n$MESSAGE\n$MESSAGE2\n LIST OF THE $AVAILABLE_APPIMAGES_NUMBER APPIMAGES AVAILABLE IN THE 'AM' REPOSITORY:\n$LIST\n" | less -I
printf "\n$MESSAGE\n$MESSAGE2\n LIST OF THE $AVAILABLE_APPIMAGES_NUMBER APPIMAGES AVAILABLE IN THE 'AM' REPOSITORY:\n$LIST\n" | less -Ir
else
LIST=$(sort "$AMPATH/$arch-apps" | _pretty_list)
printf "\n$MESSAGE\n$MESSAGE2\n LIST OF THE $AVAILABLE_APPS_NUMBER APPLICATIONS AVAILABLE IN THE 'AM' REPOSITORY:\n$LIST\n" | less -I
printf "\n$MESSAGE\n$MESSAGE2\n LIST OF THE $AVAILABLE_APPS_NUMBER APPLICATIONS AVAILABLE IN THE 'AM' REPOSITORY:\n$LIST\n" | less -Ir
fi
#printf "\n$MESSAGE\n$MESSAGE2\n"
;;
Expand Down