diff options
author | davidovski <david@davidovski.xyz> | 2022-02-20 22:42:46 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-02-20 22:42:46 +0000 |
commit | c27df8fa817d2578332ee49ccc79df133fd77f20 (patch) | |
tree | 2a8fabd0e4ae7f1334aca2b213a814dea2c74b3a /src/stats.sh | |
parent | 42352a35a057c8315e8acd8ea4217df8353ae16a (diff) |
Diffstat (limited to 'src/stats.sh')
-rw-r--r-- | src/stats.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/stats.sh b/src/stats.sh new file mode 100644 index 0000000..b7e927a --- /dev/null +++ b/src/stats.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +show_xipkg_stats () { + printf "${LIGHT_CYAN}${XI}${BLUE}Pkg ${LIGHT_CYAN}$VERSION ${BLUE}on ${LIGHT_BLUE}%s\n" $(cat /etc/hostname) + echo + printf "${LIGHT_BLACK}%-7s%*s/%s\n" "repo" 10 "installed" "total" + + for repo in ${REPOS}; do + + local total=0 + local installed=0 + for package in $(list | grep "^$repo/"); do + total=$((total+1)) + name=${package#$repo/} + [ -d ${INSTALLED_DIR}/${name} ] && + installed=$((installed+1)) + done + + if [ "$repo" = "xi" ]; then + installed=35 + fi + + printf "${LIGHT_WHITE}%-7s${GREEN}%*s${LIGHT_WHITE}/%s\n" $repo 10 $installed $total + + done +} |